Skip to content

Commit 6cd21ce

Browse files
authored
CLOUDP-290847: Do not trigger STS restarts in cert rotation E2Es (#444)
Our certificate rotation tests currently do two things: 1. Trigger STS restarts before doing anything by updating STS's `podTemplate` (adding/changing annotation). 2. Update the certificate and assert that the automation config received an update by asserting a version. This change removes the step 1 because as it seems unnecessary.
1 parent 7585256 commit 6cd21ce

File tree

4 files changed

+5
-31
lines changed

4 files changed

+5
-31
lines changed

docker/mongodb-kubernetes-tests/kubetester/mongodb.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -216,26 +216,6 @@ def trigger_architecture_migration(self):
216216
self["metadata"]["annotations"].update({"mongodb.com/v1.architecture": "static"})
217217
self.update()
218218

219-
def trigger_sts_restart(self, component=""):
220-
"""
221-
Adds or changes a label from the pod template to trigger a rolling restart of that StatefulSet.
222-
Leave component to empty if a ReplicaSet deployment is used.
223-
Set component to either "shard", "config", "mongos" to trigger a restart of the respective StatefulSet.
224-
"""
225-
pod_spec = "podSpec"
226-
if component == "shard":
227-
pod_spec = "shardPodSpec"
228-
elif component == "config":
229-
pod_spec = "configSrvPodSpec"
230-
elif component == "mongos":
231-
pod_spec = "mongosPodSpec"
232-
233-
self.load()
234-
self["spec"][pod_spec] = {
235-
"podTemplate": {"metadata": {"annotations": {"kubectl.kubernetes.io/restartedAt": str(time.time())}}}
236-
}
237-
self.update()
238-
239219
def assert_connectivity_from_connection_string(self, cnx_string: str, tls: bool, ca_path: Optional[str] = None):
240220
"""
241221
Tries to connect to a database using a connection string only.

docker/mongodb-kubernetes-tests/tests/tls/tls_x509_configure_all_options_rs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ def test_ops_manager_state_correctly_updated(self):
4848
ac_tester.assert_internal_cluster_authentication_enabled()
4949
ac_tester.assert_authentication_enabled()
5050

51-
def test_rotate_certificate_with_sts_restarting(self, mdb: MongoDB, namespace: str):
52-
mdb.trigger_sts_restart()
51+
def test_rotate_certificate(self, mdb: MongoDB, namespace: str):
5352
rotate_and_assert_certificates(mdb, namespace, "{}-cert".format(MDB_RESOURCE))
5453

55-
def test_rotate_clusterfile_with_sts_restarting(self, mdb: MongoDB, namespace: str):
56-
mdb.trigger_sts_restart()
54+
def test_rotate_clusterfile(self, mdb: MongoDB, namespace: str):
5755
rotate_and_assert_certificates(mdb, namespace, "{}-clusterfile".format(MDB_RESOURCE))

docker/mongodb-kubernetes-tests/tests/tls/tls_x509_configure_all_options_sc.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,11 @@ def test_ops_manager_state_correctly_updated(self):
9090
ac_tester.assert_authentication_enabled()
9191
ac_tester.assert_expected_users(0)
9292

93-
def test_rotate_shard_cert_with_sts_restarting(self, sc: MongoDB, namespace: str):
94-
sc.trigger_sts_restart("shard")
93+
def test_rotate_shard_cert(self, sc: MongoDB, namespace: str):
9594
rotate_and_assert_certificates(sc, namespace, f"{MDB_RESOURCE_NAME}-0-cert")
9695

97-
def test_rotate_config_cert_with_sts_restarting(self, sc: MongoDB, namespace: str):
98-
sc.trigger_sts_restart("config")
96+
def test_rotate_config_cert(self, sc: MongoDB, namespace: str):
9997
rotate_and_assert_certificates(sc, namespace, f"{MDB_RESOURCE_NAME}-config-cert")
10098

101-
def test_rotate_mongos_cert_with_sts_restarting(self, sc: MongoDB, namespace: str):
102-
sc.trigger_sts_restart("mongos")
99+
def test_rotate_mongos_cert(self, sc: MongoDB, namespace: str):
103100
rotate_and_assert_certificates(sc, namespace, f"{MDB_RESOURCE_NAME}-mongos-cert")

docker/mongodb-kubernetes-tests/tests/vaultintegration/mongodb_deployment_vault.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ def wait_for_server_certs() -> bool:
390390
def test_rotate_server_certs_with_sts_restarting(
391391
replica_set: MongoDB, vault_namespace: str, vault_name: str, namespace: str, issuer: str
392392
):
393-
replica_set.trigger_sts_restart()
394393
create_x509_mongodb_tls_certs(
395394
issuer,
396395
namespace,

0 commit comments

Comments
 (0)