From 9da2a5078aa96d8441340fd1a98a593f3770c816 Mon Sep 17 00:00:00 2001 From: asgayle Date: Mon, 23 Oct 2023 14:56:23 -0400 Subject: [PATCH] Change order for upsert --- .../keyvault/ingress_secret_provider_class_test.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/controller/keyvault/ingress_secret_provider_class_test.go b/pkg/controller/keyvault/ingress_secret_provider_class_test.go index f7c55bf0..cfe1a17b 100644 --- a/pkg/controller/keyvault/ingress_secret_provider_class_test.go +++ b/pkg/controller/keyvault/ingress_secret_provider_class_test.go @@ -194,9 +194,6 @@ func TestIngressSecretProviderClassReconcilerIntegrationWithoutSPCLabels(t *test }}, }, } - - require.NoError(t, util.Upsert(ctx, i.client, spc)) - assert.Equal(t, 0, len(spc.Labels)) beforeErrCount = testutils.GetErrMetricCount(t, ingressSecretProviderControllerName) beforeRequestCount = testutils.GetReconcileMetricCount(t, ingressSecretProviderControllerName, metrics.LabelSuccess) @@ -207,6 +204,16 @@ func TestIngressSecretProviderClassReconcilerIntegrationWithoutSPCLabels(t *test require.NoError(t, c.Get(ctx, client.ObjectKeyFromObject(spc), spc)) + require.NoError(t, util.Upsert(ctx, i.client, spc)) + assert.Equal(t, 0, len(spc.Labels)) + + beforeErrCount = testutils.GetErrMetricCount(t, ingressSecretProviderControllerName) + beforeRequestCount = testutils.GetReconcileMetricCount(t, ingressSecretProviderControllerName, metrics.LabelSuccess) + _, err = i.Reconcile(ctx, req) + require.NoError(t, err) + require.Equal(t, testutils.GetErrMetricCount(t, ingressSecretProviderControllerName), beforeErrCount) + require.Greater(t, testutils.GetReconcileMetricCount(t, ingressSecretProviderControllerName, metrics.LabelSuccess), beforeRequestCount) + expected := &secv1.SecretProviderClass{ Spec: secv1.SecretProviderClassSpec{ Provider: "azure",