diff --git a/controller/appcontroller_test.go b/controller/appcontroller_test.go index 454dfd83eaf1e..05b5d42d7d4fc 100644 --- a/controller/appcontroller_test.go +++ b/controller/appcontroller_test.go @@ -1630,7 +1630,6 @@ func TestUpdateHealthStatusProgression(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "demo", Namespace: "default", - Labels: map[string]string{"status": "Degraded"}, }, Status: v1.DeploymentStatus{ ObservedGeneration: 0, @@ -1683,28 +1682,34 @@ apps/Deployment: testCases := []struct { name string + initialStatus string expectedStatus health.HealthStatusCode }{ { name: "Degraded to Missing", + initialStatus: "Degraded", expectedStatus: health.HealthStatusMissing, }, { name: "Missing to Progressing", + initialStatus: "Missing", expectedStatus: health.HealthStatusProgressing, }, { name: "Progressing to Healthy", + initialStatus: "Progressing", expectedStatus: health.HealthStatusHealthy, }, { - name: "Healthy to Degraded", + name: "Healthy to Degraded", + initialStatus: "Healthy", expectedStatus: health.HealthStatusDegraded, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + deployment.SetLabels(map[string]string{"status": tc.initialStatus}) ctrl.processAppRefreshQueueItem() apps, err := ctrl.appLister.List(labels.Everything()) require.NoError(t, err)