@@ -21,13 +21,18 @@ func TestMain(m *testing.M) {
21
21
}
22
22
23
23
func TestReplicaSetOperatorUpgrade (t * testing.T ) {
24
- ctx := setup .SetupWithDefaultOperator (t )
24
+ resourceName := "mdb0"
25
+ testConfig := setup .LoadTestConfigFromEnv ()
26
+ ctx := setup .SetupWithTestConfig (t , testConfig , true , true , resourceName )
25
27
defer ctx .Teardown ()
26
28
27
- mdb , user := e2eutil .NewTestMongoDB (ctx , "mdb0" , "" )
29
+ mdb , user := e2eutil .NewTestMongoDB (ctx , resourceName , testConfig . Namespace )
28
30
scramUser := mdb .GetScramUsers ()[0 ]
31
+ mdb .Spec .Security .TLS = e2eutil .NewTestTLSConfig (false )
32
+ mdb .Spec .Arbiters = 1
33
+ mdb .Spec .Members = 2
29
34
30
- _ , err := setup .GeneratePasswordForUser (ctx , user , "" )
35
+ _ , err := setup .GeneratePasswordForUser (ctx , user , testConfig . Namespace )
31
36
if err != nil {
32
37
t .Fatal (err )
33
38
}
@@ -39,19 +44,22 @@ func TestReplicaSetOperatorUpgrade(t *testing.T) {
39
44
40
45
t .Run ("Create MongoDB Resource" , mongodbtests .CreateMongoDBResource (& mdb , ctx ))
41
46
t .Run ("Basic tests" , mongodbtests .BasicFunctionality (& mdb , true ))
42
- t .Run ("Keyfile authentication is configured" , tester .HasKeyfileAuth (3 ))
43
- t .Run ("Test Basic Connectivity" , tester .ConnectivitySucceeds ())
44
- t .Run ("Test SRV Connectivity" , tester .ConnectivitySucceeds (WithURI (mdb .MongoSRVURI ("" )), WithoutTls (), WithReplicaSet (mdb .Name )))
45
- t .Run ("Test Basic Connectivity with generated connection string secret" ,
46
- tester .ConnectivitySucceeds (WithURI (mongodbtests .GetConnectionStringForUser (mdb , scramUser ))))
47
- t .Run ("Test SRV Connectivity with generated connection string secret" ,
48
- tester .ConnectivitySucceeds (WithURI (mongodbtests .GetSrvConnectionStringForUser (mdb , scramUser ))))
49
- t .Run ("Ensure Authentication" , tester .EnsureAuthenticationIsConfigured (3 ))
50
47
t .Run ("AutomationConfig has the correct version" , mongodbtests .AutomationConfigVersionHasTheExpectedVersion (& mdb , 1 ))
48
+ mongodbtests .SkipTestIfLocal (t , "Ensure MongoDB TLS Configuration" , func (t * testing.T ) {
49
+ t .Run ("Has TLS Mode" , tester .HasTlsMode ("requireSSL" , 60 , WithTls (mdb )))
50
+ t .Run ("Basic Connectivity Succeeds" , tester .ConnectivitySucceeds (WithTls (mdb )))
51
+ t .Run ("SRV Connectivity Succeeds" , tester .ConnectivitySucceeds (WithURI (mdb .MongoSRVURI ("" )), WithTls (mdb )))
52
+ t .Run ("Basic Connectivity With Generated Connection String Secret Succeeds" ,
53
+ tester .ConnectivitySucceeds (WithURI (mongodbtests .GetConnectionStringForUser (mdb , scramUser )), WithTls (mdb )))
54
+ t .Run ("SRV Connectivity With Generated Connection String Secret Succeeds" ,
55
+ tester .ConnectivitySucceeds (WithURI (mongodbtests .GetSrvConnectionStringForUser (mdb , scramUser )), WithTls (mdb )))
56
+ t .Run ("Connectivity Fails" , tester .ConnectivityFails (WithoutTls ()))
57
+ t .Run ("Ensure authentication is configured" , tester .EnsureAuthenticationIsConfigured (3 , WithTls (mdb )))
58
+ })
51
59
52
60
// upgrade the operator to master
53
61
config := setup .LoadTestConfigFromEnv ()
54
- err = setup .DeployOperator (config , "mdb" , false , false )
62
+ err = setup .DeployOperator (config , resourceName , true , false )
55
63
assert .NoError (t , err )
56
64
57
65
// Perform the basic tests
@@ -71,7 +79,7 @@ func TestReplicaSetOperatorUpgradeFrom0_7_2(t *testing.T) {
71
79
testConfig .ReadinessProbeImage = "quay.io/mongodb/mongodb-kubernetes-readinessprobe:1.0.6"
72
80
testConfig .AgentImage = "quay.io/mongodb/mongodb-agent:11.0.5.6963-1"
73
81
74
- ctx := setup .SetupWithTestConfig (t , testConfig , true , resourceName )
82
+ ctx := setup .SetupWithTestConfig (t , testConfig , true , false , resourceName )
75
83
defer ctx .Teardown ()
76
84
77
85
mdb , user := e2eutil .NewTestMongoDB (ctx , resourceName , "" )
0 commit comments