Skip to content

Commit

Permalink
kubelet_test: Fix copy bug.
Browse files Browse the repository at this point in the history
Initialize the slice before copying in verifyUnorderedCalls()
and verifyStringArrayEqualsAnyOrder().
  • Loading branch information
Yifan Gu committed Mar 31, 2015
1 parent acd67eb commit 7b1ea6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/kubelet/dockertools/fake_docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion pkg/kubelet/kubelet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 7b1ea6b

Please sign in to comment.