Skip to content

Commit b5e2b1b

Browse files
committed
linmter
1 parent 5d2743b commit b5e2b1b

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ def yield_existing_csrs(csr_names, timeout=300):
13341334
return yield_existing_csrs(csr_names, timeout)
13351335

13361336
@staticmethod
1337-
def get_populated_mongo_client(hosts: list[str], ssl: bool = False) -> pymongo.MongoClient:
1337+
def get_connected_mongo_client(hosts: list[str], ssl: bool = False) -> pymongo.MongoClient:
13381338
mongodburi = KubernetesTester.build_mongodb_uri_for_rs(hosts)
13391339
options = {}
13401340
if ssl:
@@ -1353,9 +1353,7 @@ def get_replica_set_secondaries(client: pymongo.MongoClient) -> list:
13531353
Prefer this over client.secondaries, which relies on pymongo's async topology
13541354
discovery and may return an incomplete result immediately after connecting.
13551355
"""
1356-
status = client.admin.command(
1357-
"replSetGetStatus", read_preference=pymongo.ReadPreference.PRIMARY
1358-
)
1356+
status = client.admin.command("replSetGetStatus", read_preference=pymongo.ReadPreference.PRIMARY)
13591357
return [m for m in status["members"] if m["stateStr"] == "SECONDARY" and m["health"] == 1]
13601358

13611359
def _get_pods(self, podname, qty=3):

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,5 @@ def test_assert_shard_primary_replicas(self, sc: MongoDB):
149149
}
150150
for shard_idx, cluster_idx in cluster_primary_member_mapping.items():
151151
shard_primary_hostname = sc.shard_hostname(shard_idx, 0, cluster_idx)
152-
client = KubernetesTester.get_populated_mongo_client(hosts=[shard_primary_hostname])
152+
client = KubernetesTester.get_connected_mongo_client(hosts=[shard_primary_hostname])
153153
assert client.is_primary

docker/mongodb-kubernetes-tests/tests/replicaset/replica_set_pv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_replica_set_was_configured(self):
9191
"Should connect to one of the mongods and check the replica set was correctly configured."
9292
hosts = ["rs001-pv-{}.rs001-pv-svc.{}.svc.cluster.local:27017".format(i, self.namespace) for i in range(3)]
9393

94-
client = self.get_populated_mongo_client(hosts=hosts)
94+
client = self.get_connected_mongo_client(hosts=hosts)
9595

9696
assert client.primary is not None
9797
assert len(KubernetesTester.get_replica_set_secondaries(client)) == 2

docker/mongodb-kubernetes-tests/tests/shardedcluster/sharded_cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def test_both_shards_are_configured(self, sc: MongoDB):
130130
hosts.append(hostname)
131131

132132
logger.debug(f"Checking for connectivity of hosts: {hosts}")
133-
client = KubernetesTester.get_populated_mongo_client(hosts=hosts)
133+
client = KubernetesTester.get_connected_mongo_client(hosts=hosts)
134134
assert client.primary is not None
135135
assert len(KubernetesTester.get_replica_set_secondaries(client)) == 2
136136

docker/mongodb-kubernetes-tests/tests/shardedcluster/sharded_cluster_pv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_shard0_was_configured(self, sc: MongoDB):
9696
hostname = sc.shard_hostname(0, member_idx, cluster_member_client.cluster_index)
9797
hosts.append(hostname)
9898

99-
client = KubernetesTester.get_populated_mongo_client(hosts=hosts)
99+
client = KubernetesTester.get_connected_mongo_client(hosts=hosts)
100100

101101
assert client.primary is not None
102102
assert len(KubernetesTester.get_replica_set_secondaries(client)) == 2

0 commit comments

Comments
 (0)