Skip to content

Commit 58e5c70

Browse files
committed
Fix prometheus test assertions for TLS
1 parent 9f8c716 commit 58e5c70

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

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)