@@ -48,7 +48,7 @@ func TestX509CanBeEnabled_WhenThereAreOnlyTlsDeployments_ReplicaSet(t *testing.T
48
48
49
49
addKubernetesTlsResources (ctx , kubeClient , rs )
50
50
51
- reconciler := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
51
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
52
52
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
53
53
}
54
54
@@ -58,7 +58,7 @@ func TestX509ClusterAuthentication_CanBeEnabled_IfX509AuthenticationIsEnabled_Re
58
58
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
59
59
addKubernetesTlsResources (ctx , kubeClient , rs )
60
60
61
- reconciler := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
61
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
62
62
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
63
63
}
64
64
@@ -91,7 +91,7 @@ func TestUpdateOmAuthentication_NoAuthenticationEnabled(t *testing.T) {
91
91
processNames := []string {"my-rs-0" , "my-rs-1" , "my-rs-2" }
92
92
93
93
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
94
- r := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
94
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
95
95
r .updateOmAuthentication (ctx , conn , processNames , rs , "" , "" , "" , false , zap .S ())
96
96
97
97
ac , _ := conn .ReadAutomationConfig ()
@@ -112,7 +112,7 @@ func TestUpdateOmAuthentication_EnableX509_TlsNotEnabled(t *testing.T) {
112
112
rs .Spec .Security .TLSConfig .Enabled = true
113
113
114
114
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
115
- r := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
115
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
116
116
status , isMultiStageReconciliation := r .updateOmAuthentication (ctx , conn , []string {"my-rs-0" , "my-rs-1" , "my-rs-2" }, rs , "" , "" , "" , false , zap .S ())
117
117
118
118
assert .True (t , status .IsOK (), "configuring both options at once should not result in a failed status" )
@@ -124,7 +124,7 @@ func TestUpdateOmAuthentication_EnableX509_WithTlsAlreadyEnabled(t *testing.T) {
124
124
rs := DefaultReplicaSetBuilder ().SetName ("my-rs" ).SetMembers (3 ).EnableTLS ().Build ()
125
125
omConnectionFactory := om .NewCachedOMConnectionFactoryWithInitializedConnection (om .NewMockedOmConnection (deployment .CreateFromReplicaSet ("fake-mongoDBImage" , false , rs )))
126
126
kubeClient := mock .NewDefaultFakeClientWithOMConnectionFactory (omConnectionFactory , rs )
127
- r := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
127
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
128
128
status , isMultiStageReconciliation := r .updateOmAuthentication (ctx , omConnectionFactory .GetConnection (), []string {"my-rs-0" , "my-rs-1" , "my-rs-2" }, rs , "" , "" , "" , false , zap .S ())
129
129
130
130
assert .True (t , status .IsOK (), "configuring x509 when tls has already been enabled should not result in a failed status" )
@@ -139,7 +139,7 @@ func TestUpdateOmAuthentication_AuthenticationIsNotConfigured_IfAuthIsNotSet(t *
139
139
140
140
omConnectionFactory := om .NewCachedOMConnectionFactoryWithInitializedConnection (om .NewMockedOmConnection (deployment .CreateFromReplicaSet ("fake-mongoDBImage" , false , rs )))
141
141
kubeClient := mock .NewDefaultFakeClientWithOMConnectionFactory (omConnectionFactory , rs )
142
- r := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
142
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
143
143
144
144
status , _ := r .updateOmAuthentication (ctx , omConnectionFactory .GetConnection (), []string {"my-rs-0" , "my-rs-1" , "my-rs-2" }, rs , "" , "" , "" , false , zap .S ())
145
145
assert .True (t , status .IsOK (), "no authentication should have been configured" )
@@ -162,7 +162,7 @@ func TestUpdateOmAuthentication_DoesNotDisableAuth_IfAuthIsNotSet(t *testing.T)
162
162
Build ()
163
163
164
164
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
165
- reconciler := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
165
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
166
166
167
167
addKubernetesTlsResources (ctx , kubeClient , rs )
168
168
@@ -175,7 +175,7 @@ func TestUpdateOmAuthentication_DoesNotDisableAuth_IfAuthIsNotSet(t *testing.T)
175
175
176
176
rs .Spec .Security .Authentication = nil
177
177
178
- reconciler = newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
178
+ reconciler = newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
179
179
180
180
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
181
181
@@ -197,7 +197,7 @@ func TestCanConfigureAuthenticationDisabled_WithNoModes(t *testing.T) {
197
197
Build ()
198
198
199
199
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
200
- reconciler := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
200
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
201
201
202
202
addKubernetesTlsResources (ctx , kubeClient , rs )
203
203
@@ -209,7 +209,7 @@ func TestUpdateOmAuthentication_EnableX509_FromEmptyDeployment(t *testing.T) {
209
209
rs := DefaultReplicaSetBuilder ().SetName ("my-rs" ).SetMembers (3 ).EnableTLS ().EnableAuth ().EnableX509 ().Build ()
210
210
omConnectionFactory := om .NewCachedOMConnectionFactoryWithInitializedConnection (om .NewMockedOmConnection (om .NewDeployment ()))
211
211
kubeClient := mock .NewDefaultFakeClientWithOMConnectionFactory (omConnectionFactory , rs )
212
- r := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
212
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
213
213
createAgentCSRs (t , ctx , 1 , r .client , certsv1 .CertificateApproved )
214
214
215
215
status , isMultiStageReconciliation := r .updateOmAuthentication (ctx , omConnectionFactory .GetConnection (), []string {"my-rs-0" , "my-rs-1" , "my-rs-2" }, rs , "" , "" , "" , false , zap .S ())
@@ -229,7 +229,7 @@ func TestX509AgentUserIsCorrectlyConfigured(t *testing.T) {
229
229
230
230
// configure x509/tls resources
231
231
addKubernetesTlsResources (ctx , kubeClient , rs )
232
- reconciler := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
232
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
233
233
234
234
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
235
235
@@ -265,7 +265,7 @@ func TestScramAgentUserIsCorrectlyConfigured(t *testing.T) {
265
265
266
266
assert .NoError (t , err )
267
267
268
- reconciler := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
268
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
269
269
270
270
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
271
271
@@ -295,7 +295,7 @@ func TestScramAgentUser_IsNotOverridden(t *testing.T) {
295
295
}
296
296
})
297
297
298
- reconciler := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
298
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
299
299
300
300
checkReconcileSuccessful (ctx , t , reconciler , rs , kubeClient )
301
301
@@ -314,7 +314,7 @@ func TestX509InternalClusterAuthentication_CanBeEnabledWithScram_ReplicaSet(t *t
314
314
Build ()
315
315
316
316
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
317
- r := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
317
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
318
318
addKubernetesTlsResources (ctx , r .client , rs )
319
319
320
320
checkReconcileSuccessful (ctx , t , r , rs , kubeClient )
@@ -367,7 +367,7 @@ func TestConfigureLdapDeploymentAuthentication_WithScramAgentAuthentication(t *t
367
367
Build ()
368
368
369
369
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
370
- r := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
370
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
371
371
data := map [string ]string {
372
372
"password" : "LITZTOd6YiCV8j" ,
373
373
}
@@ -424,7 +424,7 @@ func TestConfigureLdapDeploymentAuthentication_WithCustomRole(t *testing.T) {
424
424
Build ()
425
425
426
426
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
427
- r := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
427
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
428
428
data := map [string ]string {
429
429
"password" : "LITZTOd6YiCV8j" ,
430
430
}
@@ -478,7 +478,7 @@ func TestConfigureLdapDeploymentAuthentication_WithAuthzQueryTemplate_AndUserToD
478
478
Build ()
479
479
480
480
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
481
- r := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
481
+ r := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
482
482
data := map [string ]string {
483
483
"password" : "LITZTOd6YiCV8j" ,
484
484
}
@@ -741,7 +741,7 @@ func TestInvalidPEM_SecretDoesNotContainKey(t *testing.T) {
741
741
Build ()
742
742
743
743
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
744
- reconciler := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
744
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
745
745
addKubernetesTlsResources (ctx , kubeClient , rs )
746
746
747
747
// Replace the secret with an empty one
@@ -796,7 +796,7 @@ func Test_NoExternalDomainPresent(t *testing.T) {
796
796
rs .Spec .ExternalAccessConfiguration = & mdbv1.ExternalAccessConfiguration {ExternalDomain : ptr .To ("foo" )}
797
797
798
798
kubeClient , omConnectionFactory := mock .NewDefaultFakeClient (rs )
799
- reconciler := newReplicaSetReconciler (ctx , kubeClient , false , omConnectionFactory .GetConnectionFunc )
799
+ reconciler := newReplicaSetReconciler (ctx , kubeClient , nil , false , omConnectionFactory .GetConnectionFunc )
800
800
addKubernetesTlsResources (ctx , kubeClient , rs )
801
801
802
802
secret := & corev1.Secret {}
0 commit comments