Fix flaky certificate controller test (#2009)

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
This commit is contained in:
Kevin Lingerfelt 2018-12-19 17:10:17 -08:00 committed by GitHub
parent d48a473985
commit 10d5ebd064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -47,16 +47,15 @@ func TestCertificateController(t *testing.T) {
t.Fatal("timed out waiting for sync")
}
actions := controller.k8sAPI.Client.(*fake.Clientset).Actions()
action := actions[len(actions)-2] // configmap create
if !action.Matches("create", "configmaps") {
t.Fatalf("expected action to be configmap create, got: %+v", action)
var found bool
for _, a := range controller.k8sAPI.Client.(*fake.Clientset).Actions() {
if a.Matches("create", "configmaps") && a.GetNamespace() == injectedNS {
found = true
}
}
if action.GetNamespace() != injectedNS {
t.Fatalf("expected action to happen in [%s] namespace, got [%s] namespace",
injectedNS, action.GetNamespace())
if !found {
t.Fatalf("configmap create event not found in [%s] namespace", injectedNS)
}
})
}