Skip to content

Commit 2ce0bd0

Browse files
authored
CLOUDP-316400: Update upgrade tests for 1.1 (#87)
# Summary Upgrade tests are currently doing the path MEKO -> MCK 1.0 We need to make a few updates to the fixtures to change that to: latest released MCK -> next MCK. E.g `1.0` -> `1.1` at the time this PR is opened. # Proof of Work E2E tests pass + they install the right operator versions (helm commands in logs)
1 parent 3178929 commit 2ce0bd0

9 files changed

+117
-129
lines changed

.evergreen-tasks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ tasks:
170170
commands:
171171
- func: "e2e_test"
172172

173-
- name: e2e_operator_upgrade_sharded_cluster
173+
- name: e2e_sharded_cluster_operator_upgrade_v1_27_to_mck
174174
tags: [ "patch-run" ]
175175
commands:
176176
- func: "e2e_test"
@@ -180,7 +180,7 @@ tasks:
180180
commands:
181181
- func: "e2e_test"
182182

183-
- name: e2e_operator_upgrade_appdb_tls
183+
- name: e2e_appdb_tls_operator_upgrade_v1_32_to_mck
184184
tags: [ "patch-run" ]
185185
commands:
186186
- func: "e2e_test"
@@ -840,7 +840,7 @@ tasks:
840840
commands:
841841
- func: "e2e_test"
842842

843-
- name: e2e_multi_cluster_appdb_state_operator_upgrade_downgrade
843+
- name: e2e_multi_cluster_appdb_upgrade_downgrade_v1_27_to_mck
844844
tags: [ "patch-run" ]
845845
commands:
846846
- func: "e2e_test"

.evergreen.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,13 @@ task_groups:
778778
<<: *setup_and_teardown_task_cloudqa
779779
tasks:
780780
- e2e_operator_upgrade_replica_set
781-
- e2e_operator_upgrade_sharded_cluster
781+
- e2e_sharded_cluster_operator_upgrade_v1_27_to_mck
782782
- e2e_operator_upgrade_ops_manager
783783
- e2e_operator_proxy
784784
- e2e_operator_partial_crd
785785
- e2e_operator_clusterwide
786786
- e2e_operator_multi_namespaces
787-
- e2e_operator_upgrade_appdb_tls
787+
- e2e_appdb_tls_operator_upgrade_v1_32_to_mck
788788
- e2e_meko_mck_upgrade
789789
<<: *teardown_group
790790

@@ -806,13 +806,13 @@ task_groups:
806806
<<: *setup_and_teardown_task_cloudqa
807807
tasks:
808808
- e2e_operator_upgrade_replica_set
809-
- e2e_operator_upgrade_sharded_cluster
809+
- e2e_sharded_cluster_operator_upgrade_v1_27_to_mck
810810
- e2e_operator_upgrade_ops_manager
811811
- e2e_operator_proxy
812812
- e2e_operator_partial_crd
813813
- e2e_operator_clusterwide
814814
- e2e_operator_multi_namespaces
815-
- e2e_operator_upgrade_appdb_tls
815+
- e2e_appdb_tls_operator_upgrade_v1_32_to_mck
816816
- e2e_meko_mck_upgrade
817817
<<: *teardown_group
818818

@@ -910,7 +910,7 @@ task_groups:
910910
- e2e_multi_cluster_om_networking_clusterwide
911911
- e2e_multi_cluster_om_appdb_no_mesh
912912
# Reused OM tests with AppDB Multi-Cluster topology
913-
- e2e_operator_upgrade_appdb_tls
913+
- e2e_appdb_tls_operator_upgrade_v1_32_to_mck
914914
- e2e_om_appdb_flags_and_config
915915
- e2e_om_appdb_upgrade
916916
- e2e_om_appdb_monitoring_tls
@@ -942,7 +942,7 @@ task_groups:
942942
- e2e_om_ops_manager_upgrade
943943
- e2e_om_update_before_reconciliation
944944
- e2e_om_feature_controls
945-
- e2e_multi_cluster_appdb_state_operator_upgrade_downgrade
945+
- e2e_multi_cluster_appdb_upgrade_downgrade_v1_27_to_mck
946946
- e2e_multi_cluster_sharded_disaster_recovery
947947
# disabled tests:
948948
# - e2e_om_multiple # multi-cluster failures in EVG
@@ -995,7 +995,7 @@ task_groups:
995995
- e2e_om_ops_manager_backup_kmip
996996
- e2e_om_ops_manager_scale
997997
- e2e_om_ops_manager_upgrade
998-
- e2e_multi_cluster_appdb_state_operator_upgrade_downgrade
998+
- e2e_multi_cluster_appdb_upgrade_downgrade_v1_27_to_mck
999999
- e2e_om_update_before_reconciliation
10001000
- e2e_om_feature_controls
10011001
- e2e_multi_cluster_sharded_disaster_recovery

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

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@
6161
LEGACY_CENTRAL_CLUSTER_NAME: str = "__default"
6262
LEGACY_DEPLOYMENT_STATE_VERSION: str = "1.27.0"
6363

64+
# Helm charts
65+
LEGACY_OPERATOR_CHART = "mongodb/enterprise-operator"
66+
MCK_HELM_CHART = "mongodb/mongodb-kubernetes"
67+
LOCAL_HELM_CHART_DIR = "helm_chart"
68+
69+
OFFICIAL_OPERATOR_IMAGE_NAME = "mongodb-kubernetes"
70+
LEGACY_OPERATOR_IMAGE_NAME = "mongodb-enterprise-operator-ubi"
71+
6472
# Names for operator and RBAC
6573
OPERATOR_NAME = "mongodb-kubernetes-operator"
6674
MULTI_CLUSTER_OPERATOR_NAME = OPERATOR_NAME + "-multi-cluster"
@@ -801,7 +809,7 @@ def _install_multi_cluster_operator(
801809
helm_opts: Dict[str, str],
802810
central_cluster_name: str,
803811
operator_name: Optional[str] = MULTI_CLUSTER_OPERATOR_NAME,
804-
helm_chart_path: Optional[str] = "helm_chart",
812+
helm_chart_path: Optional[str] = LOCAL_HELM_CHART_DIR,
805813
custom_operator_version: Optional[str] = None,
806814
) -> Operator:
807815
multi_cluster_operator_installation_config.update(helm_opts)
@@ -856,6 +864,9 @@ def official_operator(
856864
central_cluster_client,
857865
member_cluster_clients,
858866
member_cluster_names,
867+
helm_chart_path=MCK_HELM_CHART,
868+
operator_name=OPERATOR_NAME,
869+
operator_image=OFFICIAL_OPERATOR_IMAGE_NAME,
859870
)
860871

861872

@@ -877,8 +888,42 @@ def official_meko_operator(
877888
central_cluster_client,
878889
member_cluster_clients,
879890
member_cluster_names,
891+
helm_chart_path=LEGACY_OPERATOR_CHART,
892+
operator_name=LEGACY_OPERATOR_NAME,
893+
operator_image=LEGACY_OPERATOR_IMAGE_NAME,
894+
)
895+
896+
897+
# In 1.27.0, we changed the way we manage the deployment state. We use this fixture to test the upgrade path from this
898+
# version, to ensure we do not break the state
899+
def install_legacy_deployment_state_meko(
900+
namespace: str,
901+
managed_security_context: str,
902+
operator_installation_config: dict[str, str],
903+
central_cluster_name=None, # These 4 fields apply to multi cluster operator only
904+
central_cluster_client=None,
905+
member_cluster_clients=None,
906+
member_cluster_names=None,
907+
):
908+
logger.info(
909+
f"Installing the operator from chart {LEGACY_OPERATOR_CHART}, with version {LEGACY_DEPLOYMENT_STATE_VERSION}"
910+
)
911+
operator = install_official_operator(
912+
namespace,
913+
managed_security_context,
914+
operator_installation_config,
915+
central_cluster_name=central_cluster_name, # These 4 fields apply to multi cluster operator only
916+
central_cluster_client=central_cluster_client,
917+
member_cluster_clients=member_cluster_clients,
918+
member_cluster_names=member_cluster_names,
919+
custom_operator_version=LEGACY_DEPLOYMENT_STATE_VERSION,
920+
helm_chart_path=LEGACY_OPERATOR_CHART, # We are testing the upgrade from legacy state management, introduced in MEKO
880921
operator_name=LEGACY_OPERATOR_NAME,
922+
operator_image=LEGACY_OPERATOR_IMAGE_NAME,
881923
)
924+
operator.assert_is_running()
925+
# Dumping deployments in logs ensures we are using the correct operator version
926+
log_deployments_info(namespace)
882927

883928

884929
def install_official_operator(
@@ -890,7 +935,9 @@ def install_official_operator(
890935
member_cluster_clients: Optional[List[MultiClusterClient]],
891936
member_cluster_names: Optional[List[str]],
892937
custom_operator_version: Optional[str] = None,
938+
helm_chart_path: Optional[str] = MCK_HELM_CHART,
893939
operator_name: Optional[str] = OPERATOR_NAME,
940+
operator_image: Optional[str] = OFFICIAL_OPERATOR_IMAGE_NAME,
894941
) -> Operator:
895942
"""
896943
Installs the Operator from the official Helm Chart.
@@ -912,7 +959,7 @@ def install_official_operator(
912959
# Note, that we don't intend to install the official Operator to standalone clusters (kops/openshift) as we want to
913960
# avoid damaged CRDs. But we may need to install the "openshift like" environment to Kind instead of the "ubi"
914961
# images are used for installing the dev Operator
915-
helm_args["operator.operator_image_name"] = "{}-ubi".format(operator_name)
962+
helm_args["operator.operator_image_name"] = operator_image
916963

917964
# Note:
918965
# We might want in the future to install CRDs when performing upgrade/downgrade tests, the helm install only takes
@@ -966,7 +1013,7 @@ def install_official_operator(
9661013
member_cluster_clients,
9671014
helm_opts=helm_args,
9681015
central_cluster_name=get_central_cluster_name(),
969-
helm_chart_path="mongodb/enterprise-operator",
1016+
helm_chart_path=helm_chart_path,
9701017
custom_operator_version=custom_operator_version,
9711018
operator_name=operator_name,
9721019
)
@@ -976,7 +1023,7 @@ def install_official_operator(
9761023
return Operator(
9771024
namespace=namespace,
9781025
helm_args=helm_args,
979-
helm_chart_path="mongodb/enterprise-operator",
1026+
helm_chart_path=helm_chart_path,
9801027
name=operator_name,
9811028
).install(custom_operator_version=custom_operator_version)
9821029

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@
1010
from pytest import fixture, mark
1111
from tests import test_logger
1212
from tests.conftest import (
13-
LEGACY_DEPLOYMENT_STATE_VERSION,
1413
LEGACY_MULTI_CLUSTER_OPERATOR_NAME,
15-
LEGACY_OPERATOR_NAME,
1614
MULTI_CLUSTER_OPERATOR_NAME,
1715
create_appdb_certs,
1816
get_central_cluster_name,
1917
get_custom_appdb_version,
20-
install_official_operator,
18+
install_legacy_deployment_state_meko,
2119
log_deployments_info,
2220
)
2321
from tests.multicluster.conftest import cluster_spec_list
@@ -42,6 +40,8 @@
4240
At each step, we verify that the state is correct
4341
"""
4442

43+
# TODO CLOUDP-318100: this test should eventually be updated and not pinned to 1.27 anymore
44+
4545

4646
def assert_cm_expected_data(
4747
name: str, namespace: str, expected_data: Optional[Dict], central_cluster_client: kubernetes.client.ApiClient
@@ -168,7 +168,7 @@ def ops_manager(
168168
return resource
169169

170170

171-
@mark.e2e_multi_cluster_appdb_state_operator_upgrade_downgrade
171+
@mark.e2e_multi_cluster_appdb_upgrade_downgrade_v1_27_to_mck
172172
class TestOpsManagerCreation:
173173
"""
174174
Ensure correct deployment and state of AppDB, with operator version 1.27 installed.
@@ -186,23 +186,15 @@ def test_install_legacy_state_official_operator(
186186
member_cluster_clients,
187187
member_cluster_names,
188188
):
189-
logger.info(
190-
f"Installing the official operator from helm charts, with version {LEGACY_DEPLOYMENT_STATE_VERSION}"
191-
)
192-
operator = install_official_operator(
193-
namespace,
194-
managed_security_context,
195-
operator_installation_config,
196-
central_cluster_name,
197-
central_cluster_client,
198-
member_cluster_clients,
199-
member_cluster_names,
200-
custom_operator_version=LEGACY_DEPLOYMENT_STATE_VERSION,
201-
operator_name=LEGACY_OPERATOR_NAME,
189+
install_legacy_deployment_state_meko(
190+
namespace=namespace,
191+
managed_security_context=managed_security_context,
192+
operator_installation_config=operator_installation_config,
193+
central_cluster_name=central_cluster_name,
194+
central_cluster_client=central_cluster_client,
195+
member_cluster_clients=member_cluster_clients,
196+
member_cluster_names=member_cluster_names,
202197
)
203-
operator.assert_is_running()
204-
# Dumping deployments in logs ensure we are using the correct operator version
205-
log_deployments_info(namespace)
206198

207199
def test_create_appdb_certs_secret(
208200
self,
@@ -240,15 +232,15 @@ def test_state_correctness(
240232
assert_cm_expected_data(configmap_name, namespace, expected_data, central_cluster_client)
241233

242234

243-
@mark.e2e_multi_cluster_appdb_state_operator_upgrade_downgrade
235+
@mark.e2e_multi_cluster_appdb_upgrade_downgrade_v1_27_to_mck
244236
class TestOperatorUpgrade:
245237
"""
246238
Upgrade the operator to latest dev version, scale AppDB, and ensure state correctness.
247239
"""
248240

249241
def test_downscale_latest_official_operator(self, namespace: str):
250-
# Scale down the existing operator deployment to 0. This is needed as long as the
251-
# `official_operator` fixture installs the MEKO operator.
242+
# Scale down the existing operator deployment to 0. This is needed as we are initially installing MEKO
243+
# and replacing it with MCK
252244
downscale_operator_deployment(deployment_name=LEGACY_MULTI_CLUSTER_OPERATOR_NAME, namespace=namespace)
253245

254246
def test_install_default_operator(self, namespace: str, multi_cluster_operator: Operator):
@@ -285,15 +277,13 @@ def test_old_state_still_exists(
285277
)
286278

287279

288-
@mark.e2e_multi_cluster_appdb_state_operator_upgrade_downgrade
280+
@mark.e2e_multi_cluster_appdb_upgrade_downgrade_v1_27_to_mck
289281
class TestOperatorDowngrade:
290282
"""
291283
Downgrade the Operator to 1.27, scale AppDB and ensure state correctness.
292284
"""
293285

294286
def test_downscale_default_operator(self, namespace: str):
295-
# Scale down the existing operator deployment to 0. This is needed as long as the
296-
# `official_operator` fixture installs the MEKO operator.
297287
downscale_operator_deployment(deployment_name=MULTI_CLUSTER_OPERATOR_NAME, namespace=namespace)
298288

299289
def test_install_legacy_state_official_operator(
@@ -306,21 +296,15 @@ def test_install_legacy_state_official_operator(
306296
member_cluster_clients,
307297
member_cluster_names,
308298
):
309-
logger.info(f"Downgrading the operator to version {LEGACY_DEPLOYMENT_STATE_VERSION}, from helm chart release")
310-
operator = install_official_operator(
311-
namespace,
312-
managed_security_context,
313-
operator_installation_config,
314-
central_cluster_name,
315-
central_cluster_client,
316-
member_cluster_clients,
317-
member_cluster_names,
318-
custom_operator_version=LEGACY_DEPLOYMENT_STATE_VERSION,
319-
operator_name=LEGACY_OPERATOR_NAME,
299+
install_legacy_deployment_state_meko(
300+
namespace=namespace,
301+
managed_security_context=managed_security_context,
302+
operator_installation_config=operator_installation_config,
303+
central_cluster_name=central_cluster_name,
304+
central_cluster_client=central_cluster_client,
305+
member_cluster_clients=member_cluster_clients,
306+
member_cluster_names=member_cluster_names,
320307
)
321-
operator.assert_is_running()
322-
# Dumping deployments in logs ensure we are using the correct operator version
323-
log_deployments_info(namespace)
324308

325309
def test_om_running_after_downgrade(self, ops_manager: MongoDBOpsManager):
326310
ops_manager.load()

0 commit comments

Comments
 (0)