Skip to content

PYTHON-3088 Update load balancer tests to support dedicated load balancer port #866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ functions:
DISABLE_TEST_COMMANDS=${DISABLE_TEST_COMMANDS} \
ORCHESTRATION_FILE=${ORCHESTRATION_FILE} \
REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \
LOAD_BALANCER=${LOAD_BALANCER} \
bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
# run-orchestration generates expansion file with the MONGODB_URI for the cluster
- command: expansions.update
Expand Down Expand Up @@ -457,6 +458,7 @@ functions:
fi
if [ -n "${test_loadbalancer}" ]; then
export TEST_LOADBALANCER=1
export LOAD_BALANCER=1
export SINGLE_MONGOS_LB_URI="${SINGLE_MONGOS_LB_URI}"
export MULTI_MONGOS_LB_URI="${MULTI_MONGOS_LB_URI}"
fi
Expand Down Expand Up @@ -1712,8 +1714,12 @@ tasks:
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "latest"
TOPOLOGY: "sharded_cluster"
LOAD_BALANCER: true
- func: "run load-balancer"
vars:
LOAD_BALANCER: true
- func: "run tests"

- name: "test-fips-standalone"
Expand Down
7 changes: 0 additions & 7 deletions pymongo/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,6 @@ def _set_keepalive_times(sock):
# main thread, to avoid the deadlock. See PYTHON-607.
"foo".encode("idna")

# Remove after PYTHON-2712
_MOCK_SERVICE_ID = False


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

doc = self.command("admin", cmd, publish_events=False, exhaust_allowed=awaitable)
# PYTHON-2712 will remove this topologyVersion fallback logic.
if self.opts.load_balanced and _MOCK_SERVICE_ID:
process_id = doc.get("topologyVersion", {}).get("processId")
doc.setdefault("serviceId", process_id)
if not self.opts.load_balanced:
doc.pop("serviceId", None)
hello = Hello(doc, awaitable=awaitable)
Expand Down
4 changes: 0 additions & 4 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@
SINGLE_MONGOS_LB_URI = os.environ.get("SINGLE_MONGOS_LB_URI")
MULTI_MONGOS_LB_URI = os.environ.get("MULTI_MONGOS_LB_URI")
if TEST_LOADBALANCER:
# Remove after PYTHON-2712
from pymongo import pool

pool._MOCK_SERVICE_ID = True
res = parse_uri(SINGLE_MONGOS_LB_URI or "")
host, port = res["nodelist"][0]
db_user = res["username"] or db_user
Expand Down