From 912ef337f90852b58eaf6318e59f97206b281980 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Thu, 16 Apr 2026 13:32:50 -0400 Subject: [PATCH] =?UTF-8?q?PYTHON-5798=20-=20Overload=20retargeting=20pros?= =?UTF-8?q?e=20tests=20do=20not=20ensure=20that=20sec=E2=80=A6=20(#2760)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- test/asynchronous/test_retryable_reads.py | 11 ++++++++++- test/test_retryable_reads.py | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/test/asynchronous/test_retryable_reads.py b/test/asynchronous/test_retryable_reads.py index c7369db90..361db4ca9 100644 --- a/test/asynchronous/test_retryable_reads.py +++ b/test/asynchronous/test_retryable_reads.py @@ -19,7 +19,7 @@ import os import pprint import sys import threading -from test.asynchronous.utils import async_set_fail_point +from test.asynchronous.utils import async_ensure_all_connected, async_set_fail_point from unittest import mock from pymongo import MongoClient @@ -295,6 +295,9 @@ class TestRetryableReads(AsyncIntegrationTest): enableOverloadRetargeting=True, ) + # Ensure the client has discovered all nodes. + await async_ensure_all_connected(client) + # 2. Configure a fail point with the RetryableError and SystemOverloadedError error labels. command_args = { "configureFailPoint": "failCommand", @@ -334,6 +337,9 @@ class TestRetryableReads(AsyncIntegrationTest): event_listeners=[listener], retryReads=True, readPreference="primaryPreferred" ) + # Ensure the client has discovered all nodes. + await async_ensure_all_connected(client) + # 2. Configure a fail point with the RetryableError error label. command_args = { "configureFailPoint": "failCommand", @@ -375,6 +381,9 @@ class TestRetryableReads(AsyncIntegrationTest): readPreference="primaryPreferred", ) + # Ensure the client has discovered all nodes. + await async_ensure_all_connected(client) + # 2. Configure a fail point with the RetryableError and SystemOverloadedError error labels. command_args = { "configureFailPoint": "failCommand", diff --git a/test/test_retryable_reads.py b/test/test_retryable_reads.py index 751319479..2da87f8b2 100644 --- a/test/test_retryable_reads.py +++ b/test/test_retryable_reads.py @@ -19,7 +19,7 @@ import os import pprint import sys import threading -from test.utils import set_fail_point +from test.utils import ensure_all_connected, set_fail_point from unittest import mock from pymongo import MongoClient @@ -293,6 +293,9 @@ class TestRetryableReads(IntegrationTest): enableOverloadRetargeting=True, ) + # Ensure the client has discovered all nodes. + ensure_all_connected(client) + # 2. Configure a fail point with the RetryableError and SystemOverloadedError error labels. command_args = { "configureFailPoint": "failCommand", @@ -332,6 +335,9 @@ class TestRetryableReads(IntegrationTest): event_listeners=[listener], retryReads=True, readPreference="primaryPreferred" ) + # Ensure the client has discovered all nodes. + ensure_all_connected(client) + # 2. Configure a fail point with the RetryableError error label. command_args = { "configureFailPoint": "failCommand", @@ -373,6 +379,9 @@ class TestRetryableReads(IntegrationTest): readPreference="primaryPreferred", ) + # Ensure the client has discovered all nodes. + ensure_all_connected(client) + # 2. Configure a fail point with the RetryableError and SystemOverloadedError error labels. command_args = { "configureFailPoint": "failCommand",