Skip to content

test: fix whole cluster test for spock 5.0.7#383

Closed
jason-lynch wants to merge 1 commit intomainfrom
test/spock-507-whole-cluster-e2e
Closed

test: fix whole cluster test for spock 5.0.7#383
jason-lynch wants to merge 1 commit intomainfrom
test/spock-507-whole-cluster-e2e

Conversation

@jason-lynch
Copy link
Copy Markdown
Member

Summary

spock.wait_for_sync_event no longer works properly on replica instances. This commit refactors the whole cluster test to only run this function on primary instances and to use polling to wait until the replica has caught up.

Testing

# this test case works against any environment
make test-e2e E2E_RUN=TestWholeCluster 

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

Review Change Stack

Warning

Rate limit exceeded

@jason-lynch has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 27 minutes and 21 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7c916664-1cb6-4a79-b965-7bcbcc67bd36

📥 Commits

Reviewing files that changed from the base of the PR and between 6e8e78a and f5ca353.

📒 Files selected for processing (1)
  • e2e/whole_cluster_test.go
📝 Walkthrough

Walkthrough

The test's replication validation is refactored to separate concerns: primary instances are validated via explicit sync-event waits, while replicas are verified through deadline-bounded polling loops. Imports are reordered for consistency.

Changes

E2E Replication Validation Refactor

Layer / File(s) Summary
Imports
e2e/whole_cluster_test.go
Go imports reordered to group testify/require with non-controlplane imports.
Validation Logic Context
e2e/whole_cluster_test.go
Old validation iterated over all instances per read node and validated replication for each via spock.wait_for_sync_event.
Primary Instance Validation
e2e/whole_cluster_test.go
For each destination read node, fetch the primary instance by role, wait for sync event using the captured LSN, and assert primary row data equals "test".
Replica Polling Validation
e2e/whole_cluster_test.go
For each replica instance on the destination read node, connect and repeatedly poll until replica row data equals "test" within a ~5s deadline.

Poem

🐰 One test now sees with clearer eyes,
Primary first, then replicas rise—
A deadline-bounded dance of sync,
Where replicas poll until they're in sync,
Data matching, and all is well! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description includes Summary and Testing sections but is missing Changes, Checklist, and Notes for Reviewers sections required by the template. Add the missing Changes section with a bulleted list of what was modified, complete the Checklist items, and optionally add Notes for Reviewers to explain the refactoring rationale.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing the whole cluster test for spock 5.0.7 compatibility.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/spock-507-whole-cluster-e2e

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 10, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/whole_cluster_test.go`:
- Around line 127-135: The polling loop around conn.QueryRow(...) sets synced
when actual == "test" but currently only sleeps on Scan error; modify the loop
so that when the query succeeds but actual != "test" it also sleeps (e.g., add a
time.Sleep(500*time.Millisecond) before continuing) to avoid tight spinning;
update the block containing variables synced, deadline, row :=
conn.QueryRow(...), and actual to perform the sleep when the comparison fails.
- Around line 11-12: Update the pgx dependency from v5.7.6 to v5.9.2 by running:
go get github.com/jackc/pgx/v5@v5.9.2 and then go mod tidy to update
go.mod/go.sum; keep using the same import "github.com/jackc/pgx/v5" in tests
(e.g., e2e/whole_cluster_test.go) and run the test suite including race
detection (go test -race ./...) to ensure the upgrade resolves the reported
issues.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a866839c-563f-4786-bbe8-494275aa1e1f

📥 Commits

Reviewing files that changed from the base of the PR and between 2c0c395 and 6e8e78a.

📒 Files selected for processing (1)
  • e2e/whole_cluster_test.go

Comment thread e2e/whole_cluster_test.go
Comment thread e2e/whole_cluster_test.go
`spock.wait_for_sync_event` no longer works properly on replica
instances. This commit refactors the whole cluster test to only run this
function on primary instances and to use polling to wait until the
replica has caught up.
@jason-lynch jason-lynch force-pushed the test/spock-507-whole-cluster-e2e branch from 6e8e78a to f5ca353 Compare May 10, 2026 18:40
@jason-lynch jason-lynch marked this pull request as ready for review May 10, 2026 18:59
@jason-lynch
Copy link
Copy Markdown
Member Author

This issue was partially resolved by #382. This commit is already contained in #381, so I'll resolve the conflicts and update the tests there.

@jason-lynch jason-lynch deleted the test/spock-507-whole-cluster-e2e branch May 11, 2026 11:39
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.

1 participant