Skip to content

Commit

Permalink
removed unneeded test
Browse files Browse the repository at this point in the history
  • Loading branch information
aamgayle committed Oct 19, 2023
1 parent dc67ac6 commit 3e6570b
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions pkg/controller/keyvault/ingress_secret_provider_class_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ 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 @@ -332,63 +331,3 @@ func TestIngressSecretProviderClassReconcilerBuildSPCCloud(t *testing.T) {
})
}
}

func TestBuildSPCLabelChecking(t *testing.T) {
ingressClass := "webapprouting.kubernetes.azure.com"

i := &IngressSecretProviderClassReconciler{
config: &config.Config{
TenantID: "test-tenant-id",
MSIClientID: "test-msi-client-id",
},
ingressManager: NewIngressManager(map[string]struct{}{ingressClass: {}}),
}
ing := &netv1.Ingress{}
ing.Name = "test-ingress"
ing.Namespace = "default"
ing.Spec.IngressClassName = &ingressClass
ing.Annotations = map[string]string{"kubernetes.azure.com/tls-cert-keyvault-uri": "https://testvault.vault.azure.net/certificates/testcert"}

spc := &secv1.SecretProviderClass{}
spc.Name = "keyvault-" + ing.Name
spc.Namespace = ing.Namespace
spc.Labels = manifests.GetTopLevelLabels()

t.Run("no labels", func(t *testing.T) {
ing := ing.DeepCopy()
spc := spc.DeepCopy()
spc.Labels = map[string]string{}

ok, err := i.buildSPC(ing, spc)
assert.False(t, ok)
require.NoError(t, err)
})

t.Run("no top level labels", func(t *testing.T) {
ing := ing.DeepCopy()
spc.Labels = map[string]string{"fake": "fake"}

ok, err := i.buildSPC(ing, spc)
assert.False(t, ok)
require.NoError(t, err)
})

t.Run("bad value for proper key on label", func(t *testing.T) {
ing := ing.DeepCopy()
spc.Labels = map[string]string{"app.kubernetes.io/managed-by": "false-operator-name"}

ok, err := i.buildSPC(ing, spc)
assert.False(t, ok)
require.NoError(t, err)
})

t.Run("top level labels with extra labels", func(t *testing.T) {
ing := ing.DeepCopy()
extraLabels := map[string]string{"fake": "label", "fake2": "label2", "fake3": "label3"}
spc.Labels = util.MergeMaps(manifests.GetTopLevelLabels(), extraLabels)

ok, err := i.buildSPC(ing, &secv1.SecretProviderClass{})
assert.True(t, ok)
require.NoError(t, err)
})
}

0 comments on commit 3e6570b

Please sign in to comment.