Skip to content

Commit 8ffa394

Browse files
committed
Fix prometheus test assertions for TLS
1 parent 9f8c716 commit 8ffa394

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

test/e2e/e2eutil.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ func NewTestMongoDB(ctx *Context, name string, namespace string) (mdbv1.MongoDBC
115115
Resources: corev1.ResourceRequirements{
116116
Limits: map[corev1.ResourceName]resource.Quantity{
117117
"cpu": resource.MustParse("1.0"),
118-
"memory": resource.MustParse("200M"),
118+
"memory": resource.MustParse("500M"),
119119
},
120120
Requests: map[corev1.ResourceName]resource.Quantity{
121-
"cpu": resource.MustParse("0.1"),
122-
"memory": resource.MustParse("200M"),
121+
"cpu": resource.MustParse("0.5"),
122+
"memory": resource.MustParse("500M"),
123123
},
124124
},
125125
},
@@ -128,11 +128,11 @@ func NewTestMongoDB(ctx *Context, name string, namespace string) (mdbv1.MongoDBC
128128
Resources: corev1.ResourceRequirements{
129129
Limits: map[corev1.ResourceName]resource.Quantity{
130130
"cpu": resource.MustParse("1.0"),
131-
"memory": resource.MustParse("200M"),
131+
"memory": resource.MustParse("500M"),
132132
},
133133
Requests: map[corev1.ResourceName]resource.Quantity{
134-
"cpu": resource.MustParse("0.1"),
135-
"memory": resource.MustParse("200M"),
134+
"cpu": resource.MustParse("0.5"),
135+
"memory": resource.MustParse("500M"),
136136
},
137137
},
138138
},

test/e2e/prometheus/prometheus_test.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,23 @@ func TestPrometheus(t *testing.T) {
4444

4545
t.Run("Create MongoDB Resource", mongodbtests.CreateMongoDBResource(&mdb, ctx))
4646
t.Run("Basic tests", mongodbtests.BasicFunctionality(&mdb))
47-
t.Run("Keyfile authentication is configured", tester.HasKeyfileAuth(3))
48-
t.Run("Test Basic Connectivity", tester.ConnectivitySucceeds())
4947

50-
t.Run("Test Prometheus endpoint is active", tester.PrometheusEndpointIsReachable("prom-user", "prom-password", false))
51-
t.Run("Ensure Authentication", tester.EnsureAuthenticationIsConfigured(3))
52-
t.Run("AutomationConfig has the correct version", mongodbtests.AutomationConfigVersionHasTheExpectedVersion(&mdb, 1))
48+
mongodbtests.SkipTestIfLocal(t, "Ensure MongoDB with Prometheus configuration", func(t *testing.T) {
49+
t.Run("Resource has TLS Mode", tester.HasTlsMode("requireSSL", 60, WithTls(mdb)))
50+
t.Run("Test Basic Connectivity", tester.ConnectivitySucceeds(WithTls(mdb)))
51+
t.Run("Test Prometheus endpoint is active", tester.PrometheusEndpointIsReachable("prom-user", "prom-password", false))
52+
t.Run("Ensure Authentication", tester.EnsureAuthenticationIsConfigured(3, WithTls(mdb)))
53+
t.Run("AutomationConfig has the correct version", mongodbtests.AutomationConfigVersionHasTheExpectedVersion(&mdb, 1))
5354

54-
t.Run("Enabling HTTPS on the Prometheus endpoint", func(t *testing.T) {
55-
err = e2eutil.UpdateMongoDBResource(&mdb, func(mdb *v1.MongoDBCommunity) {
56-
mdb.Spec.Prometheus.TLSSecretRef.Name = "tls-certificate"
57-
})
58-
assert.NoError(t, err)
55+
t.Run("Enabling HTTPS on the Prometheus endpoint", func(t *testing.T) {
56+
err = e2eutil.UpdateMongoDBResource(&mdb, func(mdb *v1.MongoDBCommunity) {
57+
mdb.Spec.Prometheus.TLSSecretRef.Name = "tls-certificate"
58+
})
59+
assert.NoError(t, err)
5960

60-
t.Run("MongoDB Reaches Running Phase", mongodbtests.MongoDBReachesRunningPhase(&mdb))
61-
t.Run("Test Prometheus HTTPS endpoint is active", tester.PrometheusEndpointIsReachable("prom-user", "prom-password", true))
61+
t.Run("MongoDB Reaches Running Phase", mongodbtests.MongoDBReachesRunningPhase(&mdb))
62+
t.Run("Test Prometheus HTTPS endpoint is active", tester.PrometheusEndpointIsReachable("prom-user", "prom-password", true))
63+
t.Run("AutomationConfig has the correct version", mongodbtests.AutomationConfigVersionHasTheExpectedVersion(&mdb, 2))
64+
})
6265
})
63-
t.Run("AutomationConfig has the correct version", mongodbtests.AutomationConfigVersionHasTheExpectedVersion(&mdb, 2))
6466
}

0 commit comments

Comments
 (0)