From 642faf2efbfdaf4379257479e7f48490f2f95ec9 Mon Sep 17 00:00:00 2001 From: Manuel Kieweg <2939765+mkieweg@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:25:14 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Blake Pettersson Signed-off-by: Manuel Kieweg <2939765+mkieweg@users.noreply.github.com> --- controller/appcontroller_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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)