From 0a0977c1f5105a9ea3f642a0260dc451a4f56f48 Mon Sep 17 00:00:00 2001 From: zachaller Date: Thu, 13 Oct 2022 10:06:21 -0500 Subject: [PATCH] test(controller): add extra checks to TestWriteBackToInformer Signed-off-by: zachaller --- rollout/controller_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rollout/controller_test.go b/rollout/controller_test.go index 7b1f9afa2d..d7683fddec 100644 --- a/rollout/controller_test.go +++ b/rollout/controller_test.go @@ -1945,8 +1945,11 @@ func TestWriteBackToInformer(t *testing.T) { f.runController(roKey, true, false, c, i, k8sI) // Verify the informer was updated with the new unstructured object after reconciliation - obj, _, _ := c.rolloutsIndexer.GetByKey(roKey) - un := obj.(*unstructured.Unstructured) + obj, exists, err := c.rolloutsIndexer.GetByKey(roKey) + assert.NoError(t, err) + assert.True(t, exists) + un, ok := obj.(*unstructured.Unstructured) + assert.True(t, ok) stableRS, _, _ := unstructured.NestedString(un.Object, "status", "stableRS") assert.NotEmpty(t, stableRS) assert.Equal(t, rs1.Labels[v1alpha1.DefaultRolloutUniqueLabelKey], stableRS)