Skip to content

Commit 73b881d

Browse files
committed
Removed any changes to the existing tests
1 parent 2f01184 commit 73b881d

File tree

3 files changed

+26
-64
lines changed

3 files changed

+26
-64
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@
2020
from kubetester.om_queryable_backups import OMQueryableBackup
2121
from opentelemetry import trace
2222
from requests.adapters import HTTPAdapter, Retry
23-
from tests.common.ops_manager.cloud_manager import is_cloud_qa
2423

2524
from .kubetester import get_env_var_or_fail
2625

27-
skip_if_cloud_manager = pytest.mark.skipif(is_cloud_qa(), reason="Do not run in Cloud Manager")
26+
27+
def running_cloud_manager():
28+
"Determines if the current test is running against Cloud Manager"
29+
return get_env_var_or_fail("OM_HOST") == "https://cloud-qa.mongodb.com"
30+
31+
32+
skip_if_cloud_manager = pytest.mark.skipif(running_cloud_manager(), reason="Do not run in Cloud Manager")
2833

2934

3035
class BackupStatus(str, Enum):

docker/mongodb-kubernetes-tests/tests/multicluster_shardedcluster/multi_cluster_sharded_disaster_recovery.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
update_configmap,
1313
)
1414
from kubetester.kubetester import (
15+
KubernetesTester,
1516
ensure_ent_version,
1617
)
1718
from kubetester.kubetester import fixture as yaml_fixture
1819
from kubetester.kubetester import (
20+
get_env_var_or_fail,
1921
is_default_architecture_static,
2022
is_multi_cluster,
2123
run_periodically,
@@ -27,7 +29,6 @@
2729
from kubetester.phase import Phase
2830
from pytest import fixture, mark
2931
from tests import test_logger
30-
from tests.common.ops_manager.cloud_manager import is_cloud_qa
3132
from tests.conftest import (
3233
MULTI_CLUSTER_MEMBER_LIST_CONFIGMAP,
3334
get_central_cluster_client,
@@ -53,6 +54,10 @@
5354
# to reconfigure the deployment further.
5455

5556

57+
def is_cloud_qa() -> bool:
58+
return os.getenv("ops_manager_version", "cloud_qa") == "cloud_qa"
59+
60+
5661
@mark.e2e_multi_cluster_sharded_disaster_recovery
5762
def test_install_operator(multi_cluster_operator: Operator):
5863
multi_cluster_operator.assert_is_running()

docker/mongodb-kubernetes-tests/tests/upgrades/sharded_cluster_operator_upgrade_v1_27_to_mck.py

Lines changed: 13 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
from typing import Dict
1+
from typing import Dict, Optional
22

33
import pytest
4-
from kubetester import read_configmap, try_load
5-
from kubetester.certs import create_mongodb_tls_certs, create_sharded_cluster_certs
4+
from kubeobject import CustomObject
5+
from kubernetes import client
6+
from kubetester import create_or_update_configmap, read_configmap
7+
from kubetester.certs import create_sharded_cluster_certs
8+
from kubetester.kubetester import ensure_nested_objects
69
from kubetester.kubetester import fixture as yaml_fixture
710
from kubetester.mongodb import MongoDB
8-
from kubetester.mongotester import ReplicaSetTester, ShardedClusterTester
11+
from kubetester.mongotester import ShardedClusterTester
12+
from kubetester.operator import Operator
913
from kubetester.phase import Phase
1014
from tests import test_logger
1115
from tests.conftest import (
1216
LEGACY_OPERATOR_NAME,
1317
OPERATOR_NAME,
18+
get_central_cluster_client,
1419
get_default_operator,
1520
install_legacy_deployment_state_meko,
1621
log_deployments_info,
1722
)
1823
from tests.upgrades import downscale_operator_deployment
1924

2025
MDB_RESOURCE = "sh001-base"
21-
MDB_RS_RESOURCE = "rs"
2226
CERT_PREFIX = "prefix"
2327

2428
logger = test_logger.get_test_logger(__name__)
@@ -37,8 +41,6 @@
3741
If the sharded cluster resource correctly reconciles after upgrade/downgrade and scaling steps, we assume it works
3842
correctly.
3943
"""
40-
41-
4244
# TODO CLOUDP-318100: this test should eventually be updated and not pinned to 1.27 anymore
4345

4446

@@ -66,7 +68,7 @@ def server_certs(issuer: str, namespace: str) -> str:
6668
)
6769

6870

69-
@pytest.fixture(scope="function")
71+
@pytest.fixture(scope="module")
7072
def sharded_cluster(
7173
issuer_ca_configmap: str,
7274
namespace: str,
@@ -77,46 +79,15 @@ def sharded_cluster(
7779
yaml_fixture("sharded-cluster.yaml"),
7880
namespace=namespace,
7981
name=MDB_RESOURCE,
80-
).configure(om=None, project_name=MDB_RESOURCE)
81-
82-
if try_load(resource):
83-
return resource
84-
82+
)
8583
resource.set_version(custom_mdb_version)
8684
resource["spec"]["mongodsPerShardCount"] = 2
8785
resource["spec"]["configServerCount"] = 2
8886
resource["spec"]["mongosCount"] = 1
8987
resource["spec"]["persistent"] = True
9088
resource.configure_custom_tls(issuer_ca_configmap, CERT_PREFIX)
9189

92-
return resource
93-
94-
95-
@pytest.fixture(scope="module")
96-
def replica_set_certs(issuer: str, namespace: str):
97-
return create_mongodb_tls_certs(issuer, namespace, MDB_RS_RESOURCE, f"prefix-{MDB_RS_RESOURCE}-cert")
98-
99-
100-
@pytest.fixture(scope="module")
101-
def replica_set(
102-
issuer_ca_configmap: str,
103-
namespace: str,
104-
replica_set_certs: str,
105-
custom_mdb_version: str,
106-
):
107-
resource = MongoDB.from_yaml(
108-
yaml_fixture("replica-set-basic.yaml"),
109-
namespace=namespace,
110-
name=MDB_RS_RESOURCE,
111-
).configure(om=None, project_name=f"{MDB_RS_RESOURCE}")
112-
113-
if try_load(resource):
114-
return resource
115-
116-
resource.set_version(custom_mdb_version)
117-
resource.configure_custom_tls(issuer_ca_configmap, CERT_PREFIX)
118-
119-
return resource
90+
return resource.update()
12091

12192

12293
@pytest.mark.e2e_sharded_cluster_operator_upgrade_v1_27_to_mck
@@ -130,23 +101,16 @@ def test_install_legacy_deployment_state_meko(
130101
install_legacy_deployment_state_meko(namespace, managed_security_context, operator_installation_config)
131102

132103
def test_create_sharded_cluster(self, sharded_cluster: MongoDB):
133-
sharded_cluster.update()
134104
sharded_cluster.assert_reaches_phase(phase=Phase.Running, timeout=350)
135105

136106
def test_scale_up_sharded_cluster(self, sharded_cluster: MongoDB):
107+
sharded_cluster.load()
137108
sharded_cluster["spec"]["mongodsPerShardCount"] = 3
138109
sharded_cluster["spec"]["configServerCount"] = 3
139110
sharded_cluster.update()
140111
sharded_cluster.assert_reaches_phase(phase=Phase.Running, timeout=300)
141112

142113

143-
@pytest.mark.e2e_sharded_cluster_operator_upgrade_v1_27_to_mck
144-
class TestReplicaSetDeployment:
145-
def test_create_replica_set(self, replica_set: MongoDB):
146-
replica_set.update()
147-
replica_set.assert_reaches_phase(phase=Phase.Running, timeout=350)
148-
149-
150114
@pytest.mark.e2e_sharded_cluster_operator_upgrade_v1_27_to_mck
151115
class TestOperatorUpgrade:
152116

@@ -173,12 +137,6 @@ def test_sharded_cluster_reconciled(self, sharded_cluster: MongoDB, namespace: s
173137
def test_assert_connectivity(self, ca_path: str):
174138
ShardedClusterTester(MDB_RESOURCE, 1, ssl=True, ca_path=ca_path).assert_connectivity()
175139

176-
def test_replica_set_reconciled(self, replica_set: MongoDB):
177-
replica_set.assert_reaches_phase(phase=Phase.Running, timeout=850, ignore_errors=True)
178-
179-
def test_assert_connectivity_replica_set(self, ca_path: str):
180-
ReplicaSetTester(MDB_RS_RESOURCE, 3, ssl=True, ca_path=ca_path).assert_connectivity()
181-
182140
def test_scale_down_sharded_cluster(self, sharded_cluster: MongoDB, namespace: str):
183141
sharded_cluster.load()
184142
# Scale down both by 1
@@ -210,12 +168,6 @@ def test_sharded_cluster_reconciled(self, sharded_cluster: MongoDB):
210168
def test_assert_connectivity(self, ca_path: str):
211169
ShardedClusterTester(MDB_RESOURCE, 1, ssl=True, ca_path=ca_path).assert_connectivity()
212170

213-
def test_replica_set_reconciled(self, replica_set: MongoDB):
214-
replica_set.assert_reaches_phase(phase=Phase.Running, timeout=850, ignore_errors=True)
215-
216-
def test_assert_connectivity_replica_set(self, ca_path: str):
217-
ReplicaSetTester(MDB_RS_RESOURCE, 3, ssl=True, ca_path=ca_path).assert_connectivity()
218-
219171
def test_scale_up_sharded_cluster(self, sharded_cluster: MongoDB):
220172
sharded_cluster.load()
221173
sharded_cluster["spec"]["mongodsPerShardCount"] = 3

0 commit comments

Comments
 (0)