kubelet_test: Fix copy bug.

Initialize the slice before copying in verifyUnorderedCalls()
and verifyStringArrayEqualsAnyOrder().
This commit is contained in:
Yifan Gu 2015-03-30 17:02:41 -07:00
parent acd67ebea0
commit 7b1ea6b41d
2 changed files with 4 additions and 2 deletions

View File

@ -71,7 +71,8 @@ func (f *FakeDockerClient) AssertUnorderedCalls(calls []string) (err error) {
f.Lock()
defer f.Unlock()
var actual, expected []string
actual := make([]string, len(calls))
expected := make([]string, len(f.called))
copy(actual, calls)
copy(expected, f.called)

View File

@ -144,7 +144,8 @@ func verifyStringArrayEquals(t *testing.T, actual, expected []string) {
}
func verifyStringArrayEqualsAnyOrder(t *testing.T, actual, expected []string) {
var act, exp []string
act := make([]string, len(actual))
exp := make([]string, len(expected))
copy(act, actual)
copy(exp, expected)