Skip to content

Commit 912ef33

Browse files
NoahStappCopilot
andauthored
PYTHON-5798 - Overload retargeting prose tests do not ensure that sec… (mongodb#2760)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent b4e2c03 commit 912ef33

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

test/asynchronous/test_retryable_reads.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import pprint
2020
import sys
2121
import threading
22-
from test.asynchronous.utils import async_set_fail_point
22+
from test.asynchronous.utils import async_ensure_all_connected, async_set_fail_point
2323
from unittest import mock
2424

2525
from pymongo import MongoClient
@@ -295,6 +295,9 @@ async def test_03_01_retryable_reads_caused_by_overload_errors_are_retried_on_a_
295295
enableOverloadRetargeting=True,
296296
)
297297

298+
# Ensure the client has discovered all nodes.
299+
await async_ensure_all_connected(client)
300+
298301
# 2. Configure a fail point with the RetryableError and SystemOverloadedError error labels.
299302
command_args = {
300303
"configureFailPoint": "failCommand",
@@ -334,6 +337,9 @@ async def test_03_02_retryable_reads_caused_by_non_overload_errors_are_retried_o
334337
event_listeners=[listener], retryReads=True, readPreference="primaryPreferred"
335338
)
336339

340+
# Ensure the client has discovered all nodes.
341+
await async_ensure_all_connected(client)
342+
337343
# 2. Configure a fail point with the RetryableError error label.
338344
command_args = {
339345
"configureFailPoint": "failCommand",
@@ -375,6 +381,9 @@ async def test_03_03_retryable_reads_caused_by_overload_errors_are_retried_on_th
375381
readPreference="primaryPreferred",
376382
)
377383

384+
# Ensure the client has discovered all nodes.
385+
await async_ensure_all_connected(client)
386+
378387
# 2. Configure a fail point with the RetryableError and SystemOverloadedError error labels.
379388
command_args = {
380389
"configureFailPoint": "failCommand",

test/test_retryable_reads.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import pprint
2020
import sys
2121
import threading
22-
from test.utils import set_fail_point
22+
from test.utils import ensure_all_connected, set_fail_point
2323
from unittest import mock
2424

2525
from pymongo import MongoClient
@@ -293,6 +293,9 @@ def test_03_01_retryable_reads_caused_by_overload_errors_are_retried_on_a_differ
293293
enableOverloadRetargeting=True,
294294
)
295295

296+
# Ensure the client has discovered all nodes.
297+
ensure_all_connected(client)
298+
296299
# 2. Configure a fail point with the RetryableError and SystemOverloadedError error labels.
297300
command_args = {
298301
"configureFailPoint": "failCommand",
@@ -332,6 +335,9 @@ def test_03_02_retryable_reads_caused_by_non_overload_errors_are_retried_on_the_
332335
event_listeners=[listener], retryReads=True, readPreference="primaryPreferred"
333336
)
334337

338+
# Ensure the client has discovered all nodes.
339+
ensure_all_connected(client)
340+
335341
# 2. Configure a fail point with the RetryableError error label.
336342
command_args = {
337343
"configureFailPoint": "failCommand",
@@ -373,6 +379,9 @@ def test_03_03_retryable_reads_caused_by_overload_errors_are_retried_on_the_same
373379
readPreference="primaryPreferred",
374380
)
375381

382+
# Ensure the client has discovered all nodes.
383+
ensure_all_connected(client)
384+
376385
# 2. Configure a fail point with the RetryableError and SystemOverloadedError error labels.
377386
command_args = {
378387
"configureFailPoint": "failCommand",

0 commit comments

Comments
 (0)