Skip to content

Commit 147908e

Browse files
authored
chore(bigtable): fix flaky sharded query concurrency limit test by relaxing eps (googleapis#17541)
**Flaky tests**: - The test `test_read_rows_sharded_concurrency_limit` was flaky under VM execution load because it checked if all of the first 10 concurrent requests were dispatched within `eps = 0.01` seconds (10 milliseconds) of the operation's start. Due to CPU scheduling and thread context switching overhead on virtualized CI hosts (like Kokoro), dispatching 10 concurrent threads/tasks can occasionally take slightly longer than 10ms, triggering random `AssertionError` failures. **Solution**: - Relaxed the threshold `eps` from `0.01` to `0.2` seconds (200 milliseconds) in: - The async source test file: [tests/unit/data/_async/test_client.py](file:///usr/local/google/home/omairn/git/googleapis/google-cloud-python/packages/google-cloud-bigtable/tests/unit/data/_async/test_client.py) - The sync auto-generated test file: [tests/unit/data/_sync_autogen/test_client.py](file:///usr/local/google/home/omairn/git/googleapis/google-cloud-python/packages/google-cloud-bigtable/tests/unit/data/_sync_autogen/test_client.py) This allows enough scheduling margin for virtualized CI runners to pass successfully while still validating that the first 10 queries are fired concurrently without delay compared to the queued queries.
1 parent 586c7f7 commit 147908e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

packages/google-cloud-bigtable/tests/unit/data/_async/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2328,7 +2328,7 @@ async def mock_call(*args, **kwargs):
23282328
starting_timeout - kwargs["operation_timeout"]
23292329
for _, kwargs in read_rows.call_args_list
23302330
]
2331-
eps = 0.01
2331+
eps = 0.2
23322332
# first 10 should start immediately
23332333
assert all(
23342334
rpc_start_list[i] < eps for i in range(_CONCURRENCY_LIMIT)

packages/google-cloud-bigtable/tests/unit/data/_sync_autogen/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,7 @@ def mock_call(*args, **kwargs):
19261926
starting_timeout - kwargs["operation_timeout"]
19271927
for _, kwargs in read_rows.call_args_list
19281928
]
1929-
eps = 0.01
1929+
eps = 0.2
19301930
assert all(
19311931
(rpc_start_list[i] < eps for i in range(_CONCURRENCY_LIMIT))
19321932
)

0 commit comments

Comments
 (0)