Fix AssertCalls usage for kubelet fake runtimes

Despite its name, AssertCalls() does not assert anything. It returns an
error that must be checked. This was causing false negatives for
a handful of unit tests.
This commit is contained in:
Lee Verberne
2017-05-10 01:34:54 +00:00
parent c320218d7b
commit f83337a8ac
3 changed files with 72 additions and 47 deletions

View File

@@ -57,7 +57,7 @@ func TestCreatePodSandbox(t *testing.T) {
}
id, _, err := m.createPodSandbox(pod, 1)
assert.NoError(t, err)
fakeRuntime.AssertCalls([]string{"RunPodSandbox"})
assert.Contains(t, fakeRuntime.Called, "RunPodSandbox")
sandboxes, err := fakeRuntime.ListPodSandbox(&runtimeapi.PodSandboxFilter{Id: id})
assert.NoError(t, err)
assert.Equal(t, len(sandboxes), 1)