Skip to content

Commit

Permalink
Added expected check
Browse files Browse the repository at this point in the history
  • Loading branch information
aamgayle committed Oct 20, 2023
1 parent 8ccc20a commit 27ba567
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions pkg/controller/keyvault/ingress_secret_provider_class_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func TestIngressSecretProviderClassReconcilerIntegrationWithoutSPCLabels(t *test
spc.Labels = map[string]string{}
require.NoError(t, i.client.Patch(ctx, spc, client.Merge))

beforeErrCount = testutils.GetErrMetricCount(t, ingressSecretProviderControllerName)
beforeErrCount = testutils.Getgit ErrMetricCount(t, ingressSecretProviderControllerName)

Check failure on line 184 in pkg/controller/keyvault/ingress_secret_provider_class_test.go

View workflow job for this annotation

GitHub Actions / unit-test

expected ';', found ErrMetricCount
beforeRequestCount = testutils.GetReconcileMetricCount(t, ingressSecretProviderControllerName, metrics.LabelSuccess)
_, err = i.Reconcile(ctx, req)
require.NoError(t, err)
Expand All @@ -190,8 +190,27 @@ func TestIngressSecretProviderClassReconcilerIntegrationWithoutSPCLabels(t *test

require.NoError(t, c.Get(ctx, client.ObjectKeyFromObject(spc), spc))

// Test should never hit the lines in buildSPC to create the Spec so it should be nil
assert.Equal(t, spc.Spec, nil)
expected := &secv1.SecretProviderClass{
Spec: secv1.SecretProviderClassSpec{
Provider: "azure",
Parameters: map[string]string{
"keyvaultName": "testvault",
"objects": "{\"array\":[\"{\\\"objectName\\\":\\\"testcert\\\",\\\"objectType\\\":\\\"secret\\\",\\\"objectVersion\\\":\\\"f8982febc6894c0697b884f946fb1a34\\\"}\"]}",
"tenantId": i.config.TenantID,
"useVMManagedIdentity": "true",
"userAssignedIdentityID": i.config.MSIClientID,
},
SecretObjects: []*secv1.SecretObject{{
SecretName: spc.Name,
Type: "kubernetes.io/tls",
Data: []*secv1.SecretObjectData{
{ObjectName: "testcert", Key: "tls.key"},
{ObjectName: "testcert", Key: "tls.crt"},
},
}},
},
}
assert.Equal(t, expected.Spec, spc.Spec)
assert.Equal(t, len(spc.Labels), 0)
// Check for idempotence
beforeErrCount = testutils.GetErrMetricCount(t, ingressSecretProviderControllerName)
Expand Down

0 comments on commit 27ba567

Please sign in to comment.