Skip to content

Commit eb0dd7e

Browse files
committed
Simplify TLS disable test - keep certs during transition
The test was failing because removing certsSecretPrefix while TLS was still transitioning (preferTLS mode) caused MongoDB to fail with: 'The use of TLS without specifying a chain of trust is no longer supported' Fix: Just disable TLS and keep the certs. The certs are needed during the transition and harmless to keep after TLS is fully disabled.
1 parent 3acc29c commit eb0dd7e

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

docker/mongodb-kubernetes-tests/tests/opsmanager/withMonitoredAppDB/om_appdb_tls_disable.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,29 +75,24 @@ def test_disable_tls_on_appdb(ops_manager: MongoDBOpsManager):
7575
CLOUDP-351614: Disable TLS on AppDB and verify the operator correctly handles
7676
the transition without leaving stale TLS params in monitoring config.
7777
78-
TLS must be disabled in the correct order:
79-
1. First disable TLS (tls.enabled = False) while keeping certs
80-
2. Wait for the TLS mode transition to complete
81-
3. Only then remove the certs (certsSecretPrefix)
78+
This test disables TLS by setting tls.enabled = False. The operator handles
79+
the TLS mode transition: requireTLS -> preferTLS -> allowTLS -> disabled.
80+
81+
Note: We keep the certsSecretPrefix in place because:
82+
1. The cert files are needed during the TLS transition
83+
2. Removing certsSecretPrefix while TLS mode is still transitioning causes failures
84+
3. The certs are harmless to keep after TLS is disabled (just unused)
8285
"""
8386
ops_manager.load()
8487

85-
# Step 1: Disable TLS mode (keeping certs until mode transition completes)
88+
# Disable TLS mode (keeping certs for the transition)
8689
# The operator will handle the TLS mode transition: requireTLS -> preferTLS -> allowTLS -> disabled
8790
ops_manager["spec"]["applicationDatabase"]["security"]["tls"]["enabled"] = False
8891
ops_manager.update()
8992

90-
# Wait for AppDB to reach Running state after TLS mode is disabled
91-
ops_manager.appdb_status().assert_reaches_phase(Phase.Running, timeout=1200)
92-
93-
# Step 2: Now that TLS is fully disabled, we can safely remove the cert configuration
94-
# This is optional cleanup - the certs are no longer used
95-
ops_manager.load()
96-
ops_manager["spec"]["applicationDatabase"]["security"]["certsSecretPrefix"] = None
97-
ops_manager.update()
98-
99-
# Wait for AppDB to reach Running state after cert cleanup
100-
ops_manager.appdb_status().assert_reaches_phase(Phase.Running, timeout=600)
93+
# Wait for AppDB to reach Running state after TLS mode is fully disabled
94+
# Use a longer timeout as the transition goes through multiple TLS modes
95+
ops_manager.appdb_status().assert_reaches_phase(Phase.Running, timeout=1800)
10196

10297

10398
@mark.e2e_om_appdb_tls_disable

0 commit comments

Comments
 (0)