Skip to content

test: stabilize records and streams integration tests - #2816

Merged
evertoncolling merged 6 commits into
masterfrom
fix-records-streams-flaky-tests
Sep 8, 2026
Merged

test: stabilize records and streams integration tests#2816
evertoncolling merged 6 commits into
masterfrom
fix-records-streams-flaky-tests

Conversation

@evertoncolling

@evertoncolling evertoncolling commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

Fix cross-run contamination in the upsert test by scoping queries to each batch. Harden cleanup, stream creation races, consistency polling, and sync pagination with a cursor captured before ingestion.

Checklist:

  • Tests added/updated.
  • Documentation updated (test docstrings; no public API changes).
  • The PR title follows the Conventional Commit spec.

@evertoncolling
evertoncolling requested review from a team as code owners September 7, 2026 08:08

@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 data modeling records integration tests to improve robustness against eventual consistency delays and slow CI environments. Key changes include updating assert_eventually to use a deadline-based timeout, introducing a RecordBatch dataclass to track stable cursors and filters, and adding comprehensive unit tests for these integration helpers. Feedback suggests using getattr with a fallback when retrieving the name of the assertion callable in assert_eventually to prevent potential AttributeError crashes.

Comment thread tests/tests_integration/test_api/test_data_modeling/test_records.py Outdated
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.85714% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.09%. Comparing base (298b46c) to head (dc3bbf4).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...ration/test_api/test_data_modeling/test_records.py 80.32% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2816      +/-   ##
==========================================
- Coverage   93.15%   93.09%   -0.06%     
==========================================
  Files         516      516              
  Lines       53665    53722      +57     
==========================================
+ Hits        49993    50014      +21     
- Misses       3672     3708      +36     
Files with missing lines Coverage Δ
...s_unit/test_api/test_data_modeling/test_records.py 100.00% <100.00%> (ø)
...ration/test_api/test_data_modeling/test_records.py 90.62% <80.32%> (-8.52%) ⬇️

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread tests/tests_unit/test_api/test_data_modeling/test_records_integration_helpers.py Outdated
yangru96
yangru96 previously approved these changes Sep 7, 2026
@evertoncolling evertoncolling added the waiting-for-risk-review Waiting for a member of the risk review team to take an action label Sep 7, 2026
Comment thread tests/tests_unit/test_api/test_data_modeling/test_records_integration_helpers.py Outdated
Drop the shared helper module and the unit tests that exercised it. The
stabilization fixes now live inline in the integration test.
@evertoncolling evertoncolling removed the waiting-for-risk-review Waiting for a member of the risk review team to take an action label Sep 8, 2026
Comment thread tests/tests_integration/test_api/test_data_modeling/test_records.py Outdated
Comment on lines +68 to +72
@dataclass
class RecordBatch:
records: list[RecordWrite]
filter: filters.Equals # Scopes every query to this batch, so parallel runs don't see each other
cursor: str # Sync position captured before ingestion

@haakonvt haakonvt Sep 8, 2026

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.

Lets not create dataclasses purely for testing purposes

Edit: maybe this is fine, but please rename to include "test"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in dc3bbf4

evertoncolling and others added 2 commits September 8, 2026 09:31

@haakonvt haakonvt 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.

🦄 🤞

@haakonvt haakonvt self-assigned this Sep 8, 2026
@haakonvt haakonvt added risk-review-ongoing Risk review is in progress waiting-for-team Waiting for the submitter or reviewer of the PR to take an action labels Sep 8, 2026
@kandeh kandeh assigned kandeh and unassigned kandeh Sep 8, 2026
@evertoncolling
evertoncolling added this pull request to the merge queue Sep 8, 2026
Merged via the queue into master with commit 3556792 Sep 8, 2026
21 checks passed
@evertoncolling
evertoncolling deleted the fix-records-streams-flaky-tests branch September 8, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk-review-ongoing Risk review is in progress waiting-for-team Waiting for the submitter or reviewer of the PR to take an action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants