@@ -22,7 +22,7 @@ func init() {
2222func TestConfigureScramSha256 (t * testing.T ) {
2323 ctx := context .Background ()
2424 kubeClient , _ := mock .NewDefaultFakeClient ()
25- mdbNamespacedName := types.NamespacedName {Namespace : "test" , Name : "test" }
25+ mongoDBResource := types.NamespacedName {Namespace : "test" , Name : "test" }
2626
2727 dep := om .NewDeployment ()
2828 conn := om .NewMockedOmConnection (dep )
@@ -32,9 +32,10 @@ func TestConfigureScramSha256(t *testing.T) {
3232 ProcessNames : []string {"process-1" , "process-2" , "process-3" },
3333 Mechanisms : []string {"SCRAM" },
3434 AgentMechanism : "SCRAM" ,
35+ MongoDBResource : mongoDBResource ,
3536 }
3637
37- if err := Configure (ctx , kubeClient , mdbNamespacedName , conn , opts , false , zap .S ()); err != nil {
38+ if err := Configure (ctx , kubeClient , conn , opts , false , zap .S ()); err != nil {
3839 t .Fatal (err )
3940 }
4041
@@ -50,7 +51,7 @@ func TestConfigureScramSha256(t *testing.T) {
5051func TestConfigureX509 (t * testing.T ) {
5152 ctx := context .Background ()
5253 kubeClient , _ := mock .NewDefaultFakeClient ()
53- mdbNamespacedName := types.NamespacedName {Namespace : "test" , Name : "test" }
54+ mongoDBResource := types.NamespacedName {Namespace : "test" , Name : "test" }
5455
5556 dep := om .NewDeployment ()
5657 conn := om .NewMockedOmConnection (dep )
@@ -64,9 +65,10 @@ func TestConfigureX509(t *testing.T) {
6465 UserOptions : UserOptions {
6566 AutomationSubject : validSubject ("automation" ),
6667 },
68+ MongoDBResource : mongoDBResource ,
6769 }
6870
69- if err := Configure (ctx , kubeClient , mdbNamespacedName , conn , opts , false , zap .S ()); err != nil {
71+ if err := Configure (ctx , kubeClient , conn , opts , false , zap .S ()); err != nil {
7072 t .Fatal (err )
7173 }
7274
@@ -82,7 +84,7 @@ func TestConfigureX509(t *testing.T) {
8284func TestConfigureScramSha1 (t * testing.T ) {
8385 ctx := context .Background ()
8486 kubeClient , _ := mock .NewDefaultFakeClient ()
85- mdbNamespacedName := types.NamespacedName {Namespace : "test" , Name : "test" }
87+ mongoDBResource := types.NamespacedName {Namespace : "test" , Name : "test" }
8688
8789 dep := om .NewDeployment ()
8890 conn := om .NewMockedOmConnection (dep )
@@ -92,9 +94,10 @@ func TestConfigureScramSha1(t *testing.T) {
9294 ProcessNames : []string {"process-1" , "process-2" , "process-3" },
9395 Mechanisms : []string {"SCRAM-SHA-1" },
9496 AgentMechanism : "SCRAM-SHA-1" ,
97+ MongoDBResource : mongoDBResource ,
9598 }
9699
97- if err := Configure (ctx , kubeClient , mdbNamespacedName , conn , opts , false , zap .S ()); err != nil {
100+ if err := Configure (ctx , kubeClient , conn , opts , false , zap .S ()); err != nil {
98101 t .Fatal (err )
99102 }
100103
@@ -108,7 +111,7 @@ func TestConfigureScramSha1(t *testing.T) {
108111func TestConfigureMultipleAuthenticationMechanisms (t * testing.T ) {
109112 ctx := context .Background ()
110113 kubeClient , _ := mock .NewDefaultFakeClient ()
111- mdbNamespacedName := types.NamespacedName {Namespace : "test" , Name : "test" }
114+ mongoDBResource := types.NamespacedName {Namespace : "test" , Name : "test" }
112115
113116 dep := om .NewDeployment ()
114117 conn := om .NewMockedOmConnection (dep )
@@ -121,9 +124,10 @@ func TestConfigureMultipleAuthenticationMechanisms(t *testing.T) {
121124 UserOptions : UserOptions {
122125 AutomationSubject : validSubject ("automation" ),
123126 },
127+ MongoDBResource : mongoDBResource ,
124128 }
125129
126- if err := Configure (ctx , kubeClient , mdbNamespacedName , conn , opts , false , zap .S ()); err != nil {
130+ if err := Configure (ctx , kubeClient , conn , opts , false , zap .S ()); err != nil {
127131 t .Fatal (err )
128132 }
129133
@@ -145,7 +149,7 @@ func TestConfigureMultipleAuthenticationMechanisms(t *testing.T) {
145149func TestDisableAuthentication (t * testing.T ) {
146150 ctx := context .Background ()
147151 kubeClient , _ := mock .NewDefaultFakeClient ()
148- mdbNamespacedName := types.NamespacedName {Namespace : "test" , Name : "test" }
152+ mongoDBResource := types.NamespacedName {Namespace : "test" , Name : "test" }
149153
150154 dep := om .NewDeployment ()
151155 conn := om .NewMockedOmConnection (dep )
@@ -156,7 +160,7 @@ func TestDisableAuthentication(t *testing.T) {
156160 return nil
157161 }, zap .S ())
158162
159- if err := Disable (ctx , kubeClient , mdbNamespacedName , conn , Options {}, true , zap .S ()); err != nil {
163+ if err := Disable (ctx , kubeClient , conn , Options {MongoDBResource : mongoDBResource }, true , zap .S ()); err != nil {
160164 t .Fatal (err )
161165 }
162166
@@ -237,9 +241,10 @@ func assertDeploymentMechanismsConfigured(t *testing.T, authMechanism Mechanism,
237241func assertAgentAuthenticationDisabled (t * testing.T , authMechanism Mechanism , conn om.Connection , opts Options ) {
238242 ctx := context .Background ()
239243 kubeClient , _ := mock .NewDefaultFakeClient ()
240- mdbNamespacedName := types.NamespacedName {Namespace : "test" , Name : "test" }
244+ mongoDBResource := types.NamespacedName {Namespace : "test" , Name : "test" }
245+ opts .MongoDBResource = mongoDBResource
241246
242- err := authMechanism .EnableAgentAuthentication (ctx , kubeClient , mdbNamespacedName , conn , opts , zap .S ())
247+ err := authMechanism .EnableAgentAuthentication (ctx , kubeClient , conn , opts , zap .S ())
243248 require .NoError (t , err )
244249
245250 ac , err := conn .ReadAutomationConfig ()
0 commit comments