Skip to content

Commit

Permalink
Upsert change
Browse files Browse the repository at this point in the history
  • Loading branch information
aamgayle committed Oct 20, 2023
1 parent fff6a13 commit f7e9cb4
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions pkg/controller/keyvault/ingress_secret_provider_class_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"
"github.com/Azure/aks-app-routing-operator/pkg/manifests"
"github.com/Azure/aks-app-routing-operator/pkg/util"
"net/url"
"testing"

Expand Down Expand Up @@ -175,11 +176,26 @@ func TestIngressSecretProviderClassReconcilerIntegrationWithoutSPCLabels(t *test
require.Greater(t, testutils.GetReconcileMetricCount(t, ingressSecretProviderControllerName, metrics.LabelSuccess), beforeRequestCount)

// Prove it exists
spc := &secv1.SecretProviderClass{}
spc.Name = "keyvault-" + ing.Name
spc.Namespace = ing.Namespace
spc.Labels = map[string]string{}
require.NoError(t, i.client.Patch(ctx, spc, client.Merge))
spc := &secv1.SecretProviderClass{
TypeMeta: metav1.TypeMeta{
APIVersion: "secrets-store.csi.x-k8s.io/v1",
Kind: "SecretProviderClass",
},
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("keyvault-%s", ing.Name),
Namespace: ing.Namespace,
Labels: map[string]string{},
OwnerReferences: []metav1.OwnerReference{{
APIVersion: ing.APIVersion,
Controller: util.BoolPtr(true),
Kind: ing.Kind,
Name: ing.Name,
UID: ing.UID,
}},
},
}

require.NoError(t, util.Upsert(ctx, i.client, spc))
assert.Equal(t, 0, len(spc.Labels))

beforeErrCount = testutils.GetErrMetricCount(t, ingressSecretProviderControllerName)
Expand Down

0 comments on commit f7e9cb4

Please sign in to comment.