Skip to content

Commit 341d489

Browse files
authored
PYTHON-3088 Update load balancer tests to support dedicated load balancer port (#866)
1 parent 405c11d commit 341d489

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

.evergreen/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ functions:
292292
DISABLE_TEST_COMMANDS=${DISABLE_TEST_COMMANDS} \
293293
ORCHESTRATION_FILE=${ORCHESTRATION_FILE} \
294294
REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \
295+
LOAD_BALANCER=${LOAD_BALANCER} \
295296
bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
296297
# run-orchestration generates expansion file with the MONGODB_URI for the cluster
297298
- command: expansions.update
@@ -457,6 +458,7 @@ functions:
457458
fi
458459
if [ -n "${test_loadbalancer}" ]; then
459460
export TEST_LOADBALANCER=1
461+
export LOAD_BALANCER=1
460462
export SINGLE_MONGOS_LB_URI="${SINGLE_MONGOS_LB_URI}"
461463
export MULTI_MONGOS_LB_URI="${MULTI_MONGOS_LB_URI}"
462464
fi
@@ -1712,8 +1714,12 @@ tasks:
17121714
commands:
17131715
- func: "bootstrap mongo-orchestration"
17141716
vars:
1717+
VERSION: "latest"
17151718
TOPOLOGY: "sharded_cluster"
1719+
LOAD_BALANCER: true
17161720
- func: "run load-balancer"
1721+
vars:
1722+
LOAD_BALANCER: true
17171723
- func: "run tests"
17181724

17191725
- name: "test-fips-standalone"

pymongo/pool.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,6 @@ def _set_keepalive_times(sock):
248248
# main thread, to avoid the deadlock. See PYTHON-607.
249249
"foo".encode("idna")
250250

251-
# Remove after PYTHON-2712
252-
_MOCK_SERVICE_ID = False
253-
254251

255252
def _raise_connection_failure(address, error, msg_prefix=None):
256253
"""Convert a socket.error to ConnectionFailure and raise it."""
@@ -633,10 +630,6 @@ def _hello(self, cluster_time, topology_version, heartbeat_frequency):
633630
auth_ctx = None
634631

635632
doc = self.command("admin", cmd, publish_events=False, exhaust_allowed=awaitable)
636-
# PYTHON-2712 will remove this topologyVersion fallback logic.
637-
if self.opts.load_balanced and _MOCK_SERVICE_ID:
638-
process_id = doc.get("topologyVersion", {}).get("processId")
639-
doc.setdefault("serviceId", process_id)
640633
if not self.opts.load_balanced:
641634
doc.pop("serviceId", None)
642635
hello = Hello(doc, awaitable=awaitable)

test/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@
101101
SINGLE_MONGOS_LB_URI = os.environ.get("SINGLE_MONGOS_LB_URI")
102102
MULTI_MONGOS_LB_URI = os.environ.get("MULTI_MONGOS_LB_URI")
103103
if TEST_LOADBALANCER:
104-
# Remove after PYTHON-2712
105-
from pymongo import pool
106-
107-
pool._MOCK_SERVICE_ID = True
108104
res = parse_uri(SINGLE_MONGOS_LB_URI or "")
109105
host, port = res["nodelist"][0]
110106
db_user = res["username"] or db_user

0 commit comments

Comments
 (0)