From 73e057380d2aa2bc28d712d905f36d2e9443f452 Mon Sep 17 00:00:00 2001 From: Stefano Lottini Date: Mon, 18 Mar 2024 18:17:59 +0100 Subject: [PATCH] more stringent values to ensure timeout tests pass --- .../idiomatic/integration/test_timeout_async.py | 16 +++++++--------- tests/idiomatic/integration/test_timeout_sync.py | 12 ++++++------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/idiomatic/integration/test_timeout_async.py b/tests/idiomatic/integration/test_timeout_async.py index 08351f0b..c989fac7 100644 --- a/tests/idiomatic/integration/test_timeout_async.py +++ b/tests/idiomatic/integration/test_timeout_async.py @@ -110,16 +110,14 @@ async def test_insert_many_timeout_exceptions_async( ) with pytest.raises(DataAPITimeoutException): - await async_collection.insert_many( - fifty_docs, ordered=True, max_time_ms=200 - ) + await async_collection.insert_many(fifty_docs, ordered=True, max_time_ms=2) with pytest.raises(DataAPITimeoutException): await async_collection.insert_many( - fifty_docs, ordered=False, concurrency=1, max_time_ms=200 + fifty_docs, ordered=False, concurrency=1, max_time_ms=2 ) with pytest.raises(DataAPITimeoutException): await async_collection.insert_many( - fifty_docs, ordered=False, concurrency=2, max_time_ms=200 + fifty_docs, ordered=False, concurrency=2, max_time_ms=2 ) @pytest.mark.describe("test of update_many timeouts, async") @@ -137,7 +135,7 @@ async def test_update_many_timeout_exceptions_async( with pytest.raises(DataAPITimeoutException): await async_collection.update_many( - {"f": "update_many"}, {"$inc": {"seq": 100}}, max_time_ms=200 + {"f": "update_many"}, {"$inc": {"seq": 100}}, max_time_ms=2 ) @pytest.mark.describe("test of delete_many timeouts, async") @@ -157,7 +155,7 @@ async def test_delete_many_timeout_exceptions_async( await async_collection.delete_many({"f": "delete_many1"}) await async_collection.delete_many({"f": "delete_many2"}, max_time_ms=20000) with pytest.raises(DataAPITimeoutException): - await async_collection.delete_many({"f": "delete_many3"}, max_time_ms=200) + await async_collection.delete_many({"f": "delete_many3"}, max_time_ms=2) @pytest.mark.describe("test of bulk_write timeouts, async") async def test_bulk_write_ordered_timeout_exceptions_async( @@ -174,7 +172,7 @@ async def test_bulk_write_ordered_timeout_exceptions_async( ) with pytest.raises(DataAPITimeoutException): await async_empty_collection.bulk_write( - [im_a, im_b, dm], ordered=True, max_time_ms=500 + [im_a, im_b, dm], ordered=True, max_time_ms=5 ) @pytest.mark.describe("test of bulk_write timeouts, async") @@ -192,5 +190,5 @@ async def test_bulk_write_unordered_timeout_exceptions_async( ) with pytest.raises(DataAPITimeoutException): await async_empty_collection.bulk_write( - [im_a, im_b, dm], ordered=False, max_time_ms=500 + [im_a, im_b, dm], ordered=False, max_time_ms=5 ) diff --git a/tests/idiomatic/integration/test_timeout_sync.py b/tests/idiomatic/integration/test_timeout_sync.py index d494b7af..d9bdbb56 100644 --- a/tests/idiomatic/integration/test_timeout_sync.py +++ b/tests/idiomatic/integration/test_timeout_sync.py @@ -108,14 +108,14 @@ def test_insert_many_timeout_exceptions_sync( ) with pytest.raises(DataAPITimeoutException): - sync_collection.insert_many(fifty_docs, ordered=True, max_time_ms=200) + sync_collection.insert_many(fifty_docs, ordered=True, max_time_ms=2) with pytest.raises(DataAPITimeoutException): sync_collection.insert_many( - fifty_docs, ordered=False, concurrency=1, max_time_ms=200 + fifty_docs, ordered=False, concurrency=1, max_time_ms=2 ) with pytest.raises(DataAPITimeoutException): sync_collection.insert_many( - fifty_docs, ordered=False, concurrency=2, max_time_ms=200 + fifty_docs, ordered=False, concurrency=2, max_time_ms=2 ) @pytest.mark.describe("test of update_many timeouts, sync") @@ -133,7 +133,7 @@ def test_update_many_timeout_exceptions_sync( with pytest.raises(DataAPITimeoutException): sync_collection.update_many( - {"f": "update_many"}, {"$inc": {"seq": 100}}, max_time_ms=200 + {"f": "update_many"}, {"$inc": {"seq": 100}}, max_time_ms=2 ) @pytest.mark.describe("test of delete_many timeouts, sync") @@ -153,7 +153,7 @@ def test_delete_many_timeout_exceptions_sync( sync_collection.delete_many({"f": "delete_many1"}) sync_collection.delete_many({"f": "delete_many2"}, max_time_ms=20000) with pytest.raises(DataAPITimeoutException): - sync_collection.delete_many({"f": "delete_many3"}, max_time_ms=200) + sync_collection.delete_many({"f": "delete_many3"}, max_time_ms=2) @pytest.mark.describe("test of bulk_write timeouts, sync") def test_bulk_write_ordered_timeout_exceptions_sync( @@ -188,5 +188,5 @@ def test_bulk_write_unordered_timeout_exceptions_sync( ) with pytest.raises(DataAPITimeoutException): sync_empty_collection.bulk_write( - [im_a, im_b, dm], ordered=False, max_time_ms=500 + [im_a, im_b, dm], ordered=False, max_time_ms=5 )