Skip to content

chore(bigtable): fix flaky sharded query concurrency limit test by relaxing eps#17541

Merged
parthea merged 4 commits into
mainfrom
fix-flaky-bigtable-test
Jun 23, 2026
Merged

chore(bigtable): fix flaky sharded query concurrency limit test by relaxing eps#17541
parthea merged 4 commits into
mainfrom
fix-flaky-bigtable-test

Conversation

@ohmayr

@ohmayr ohmayr commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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
    • The sync auto-generated test file: 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.

@ohmayr ohmayr requested a review from a team as a code owner June 23, 2026 16:17

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the test_mutations_batcher_flush_interval unit test to mock threading.Timer instead of using time.sleep, which speeds up the test execution. The reviewer noted that manually invoking the timer callback and asserting mocked_flush.assert_called_once_with() is redundant because the callback is already the mocked_flush mock itself, and suggested removing these redundant assertions.

Comment thread packages/google-cloud-bigtable/tests/unit/v2_client/test_batcher.py Outdated
@ohmayr ohmayr changed the title chore(bigtable): fix flaky batcher flush interval test chore(bigtable): fix flaky batcher flush interval and sharded query concurrency tests Jun 23, 2026
@ohmayr ohmayr changed the title chore(bigtable): fix flaky batcher flush interval and sharded query concurrency tests chore(bigtable): fix flaky sharded query concurrency limit test by relaxing eps Jun 23, 2026
@parthea parthea merged commit 147908e into main Jun 23, 2026
35 checks passed
@parthea parthea deleted the fix-flaky-bigtable-test branch June 23, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants