Skip to content

Commit 1baab03

Browse files
committed
chore(tests): update key for objects to add to unit tests
Signed-off-by: Matthew H. Irby <matt.irby@keyfactor.com>
1 parent fa32ffa commit 1baab03

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

internal/controller/issuer_controller_test.go

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
962962
name string
963963
issuerSpec commandissuerv1alpha1.IssuerSpec
964964
secretNamespace string
965-
secrets []client.Object
965+
objects []client.Object
966966
expectedConfig *command.Config
967967
expectedError error
968968
expectedErrorMsg string
@@ -977,7 +977,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
977977
SecretName: "auth-secret",
978978
},
979979
secretNamespace: "ns1",
980-
secrets: []client.Object{
980+
objects: []client.Object{
981981
&corev1.Secret{
982982
Type: corev1.SecretTypeBasicAuth,
983983
ObjectMeta: metav1.ObjectMeta{
@@ -1010,7 +1010,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
10101010
CaSecretName: "ca-secret",
10111011
},
10121012
secretNamespace: "ns1",
1013-
secrets: []client.Object{
1013+
objects: []client.Object{
10141014
&corev1.Secret{
10151015
Type: corev1.SecretTypeBasicAuth,
10161016
ObjectMeta: metav1.ObjectMeta{
@@ -1030,7 +1030,6 @@ func TestCommandConfigFromIssuer(t *testing.T) {
10301030
},
10311031
Data: map[string][]byte{
10321032
"tls.crt": []byte("-----BEGIN CERTIFICATE-----\nABCD...\n-----END CERTIFICATE-----"),
1033-
"ca.crt": []byte("-----BEGIN CERTIFICATE-----\nMIIC...\n-----END CERTIFICATE-----"),
10341033
},
10351034
},
10361035
},
@@ -1056,7 +1055,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
10561055
CaBundleKey: "ca.crt",
10571056
},
10581057
secretNamespace: "ns1",
1059-
secrets: []client.Object{
1058+
objects: []client.Object{
10601059
&corev1.Secret{
10611060
Type: corev1.SecretTypeBasicAuth,
10621061
ObjectMeta: metav1.ObjectMeta{
@@ -1101,7 +1100,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
11011100
CaBundleConfigMapName: "ca-configmap",
11021101
},
11031102
secretNamespace: "ns1",
1104-
secrets: []client.Object{
1103+
objects: []client.Object{
11051104
&corev1.Secret{
11061105
Type: corev1.SecretTypeBasicAuth,
11071106
ObjectMeta: metav1.ObjectMeta{
@@ -1119,7 +1118,6 @@ func TestCommandConfigFromIssuer(t *testing.T) {
11191118
Namespace: "ns1",
11201119
},
11211120
Data: map[string]string{
1122-
"ca.crt": "-----BEGIN CERTIFICATE-----\nMIIC...\n-----END CERTIFICATE-----",
11231121
"tls.crt": "-----BEGIN CERTIFICATE-----\nABCD...\n-----END CERTIFICATE-----",
11241122
},
11251123
},
@@ -1146,7 +1144,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
11461144
CaBundleKey: "ca.crt",
11471145
},
11481146
secretNamespace: "ns1",
1149-
secrets: []client.Object{
1147+
objects: []client.Object{
11501148
&corev1.Secret{
11511149
Type: corev1.SecretTypeBasicAuth,
11521150
ObjectMeta: metav1.ObjectMeta{
@@ -1191,7 +1189,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
11911189
CaBundleConfigMapName: "ca-configmap",
11921190
},
11931191
secretNamespace: "ns1",
1194-
secrets: []client.Object{
1192+
objects: []client.Object{
11951193
&corev1.Secret{
11961194
Type: corev1.SecretTypeBasicAuth,
11971195
ObjectMeta: metav1.ObjectMeta{
@@ -1243,7 +1241,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
12431241
SecretName: "oauth-secret",
12441242
},
12451243
secretNamespace: "ns1",
1246-
secrets: []client.Object{
1244+
objects: []client.Object{
12471245
&corev1.Secret{
12481246
Type: corev1.SecretTypeOpaque,
12491247
ObjectMeta: metav1.ObjectMeta{
@@ -1277,7 +1275,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
12771275
SecretName: "oauth-secret",
12781276
},
12791277
secretNamespace: "ns1",
1280-
secrets: []client.Object{
1278+
objects: []client.Object{
12811279
&corev1.Secret{
12821280
Type: corev1.SecretTypeOpaque,
12831281
ObjectMeta: metav1.ObjectMeta{
@@ -1316,7 +1314,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
13161314
Audience: "https://api.example.com",
13171315
},
13181316
secretNamespace: "ns1",
1319-
secrets: []client.Object{},
1317+
objects: []client.Object{},
13201318
expectedConfig: &command.Config{
13211319
Hostname: "https://ca.example.com",
13221320
APIPath: "/api/v1",
@@ -1331,7 +1329,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
13311329
APIPath: "/api/v1",
13321330
},
13331331
secretNamespace: "ns1",
1334-
secrets: []client.Object{},
1332+
objects: []client.Object{},
13351333
expectedConfig: &command.Config{
13361334
Hostname: "https://ca.example.com",
13371335
APIPath: "/api/v1",
@@ -1346,7 +1344,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
13461344
SecretName: "missing-secret",
13471345
},
13481346
secretNamespace: "ns1",
1349-
secrets: []client.Object{},
1347+
objects: []client.Object{},
13501348
expectedError: errGetAuthSecret,
13511349
},
13521350
{
@@ -1356,7 +1354,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
13561354
CaSecretName: "missing-ca-secret",
13571355
},
13581356
secretNamespace: "ns1",
1359-
secrets: []client.Object{},
1357+
objects: []client.Object{},
13601358
expectedError: errGetCaSecret,
13611359
},
13621360
{
@@ -1367,7 +1365,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
13671365
CaBundleKey: "ca.crt",
13681366
},
13691367
secretNamespace: "ns1",
1370-
secrets: []client.Object{
1368+
objects: []client.Object{
13711369
&corev1.Secret{
13721370
Type: corev1.SecretTypeOpaque,
13731371
ObjectMeta: metav1.ObjectMeta{
@@ -1388,7 +1386,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
13881386
CaBundleConfigMapName: "missing-ca-bundle",
13891387
},
13901388
secretNamespace: "ns1",
1391-
secrets: []client.Object{},
1389+
objects: []client.Object{},
13921390
expectedError: errGetCaConfigMap,
13931391
},
13941392
{
@@ -1399,7 +1397,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
13991397
CaBundleKey: "ca.crt",
14001398
},
14011399
secretNamespace: "ns1",
1402-
secrets: []client.Object{
1400+
objects: []client.Object{
14031401
&corev1.ConfigMap{
14041402
ObjectMeta: metav1.ObjectMeta{
14051403
Name: "ca-configmap",
@@ -1419,7 +1417,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
14191417
SecretName: "auth-secret",
14201418
},
14211419
secretNamespace: "ns1",
1422-
secrets: []client.Object{
1420+
objects: []client.Object{
14231421
&corev1.Secret{
14241422
Type: corev1.SecretTypeBasicAuth,
14251423
ObjectMeta: metav1.ObjectMeta{
@@ -1441,7 +1439,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
14411439
SecretName: "auth-secret",
14421440
},
14431441
secretNamespace: "ns1",
1444-
secrets: []client.Object{
1442+
objects: []client.Object{
14451443
&corev1.Secret{
14461444
Type: corev1.SecretTypeBasicAuth,
14471445
ObjectMeta: metav1.ObjectMeta{
@@ -1463,7 +1461,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
14631461
SecretName: "oauth-secret",
14641462
},
14651463
secretNamespace: "ns1",
1466-
secrets: []client.Object{
1464+
objects: []client.Object{
14671465
&corev1.Secret{
14681466
Type: corev1.SecretTypeOpaque,
14691467
ObjectMeta: metav1.ObjectMeta{
@@ -1486,7 +1484,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
14861484
SecretName: "oauth-secret",
14871485
},
14881486
secretNamespace: "ns1",
1489-
secrets: []client.Object{
1487+
objects: []client.Object{
14901488
&corev1.Secret{
14911489
Type: corev1.SecretTypeOpaque,
14921490
ObjectMeta: metav1.ObjectMeta{
@@ -1509,7 +1507,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
15091507
SecretName: "oauth-secret",
15101508
},
15111509
secretNamespace: "ns1",
1512-
secrets: []client.Object{
1510+
objects: []client.Object{
15131511
&corev1.Secret{
15141512
Type: corev1.SecretTypeOpaque,
15151513
ObjectMeta: metav1.ObjectMeta{
@@ -1532,7 +1530,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
15321530
SecretName: "auth-secret",
15331531
},
15341532
secretNamespace: "ns1",
1535-
secrets: []client.Object{
1533+
objects: []client.Object{
15361534
&corev1.Secret{
15371535
Type: corev1.SecretTypeTLS,
15381536
ObjectMeta: metav1.ObjectMeta{
@@ -1555,7 +1553,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
15551553
SecretName: "auth-secret",
15561554
},
15571555
secretNamespace: "kube-system",
1558-
secrets: []client.Object{
1556+
objects: []client.Object{
15591557
&corev1.Secret{
15601558
Type: corev1.SecretTypeBasicAuth,
15611559
ObjectMeta: metav1.ObjectMeta{
@@ -1588,7 +1586,7 @@ func TestCommandConfigFromIssuer(t *testing.T) {
15881586
t.Run(tc.name, func(t *testing.T) {
15891587
fakeClient := fake.NewClientBuilder().
15901588
WithScheme(scheme).
1591-
WithObjects(tc.secrets...).
1589+
WithObjects(tc.objects...).
15921590
Build()
15931591

15941592
// Create a minimal issuer with the test spec

0 commit comments

Comments
 (0)