Skip to content

Fix several test-harness issues that can cause flaky failures. - #4805

Merged
madolson merged 2 commits into
valkey-io:unstablefrom
artikell:fix/test-loading-and-retry-harness
Oct 30, 2026
Merged

madolson merged 2 commits into
valkey-io:unstablefrom
artikell:fix/test-loading-and-retry-harness

Conversation

@artikell

Copy link
Copy Markdown
Contributor

Fix several test-harness issues that can cause flaky failures or misleading diagnostics:

  • Treat a replica LOADING reply as a pending result while waiting for a value to propagate, but re-raise every other command error instead of masking it.
  • Include the replica reply from the final propagation attempt in the timeout diagnostic.
  • Wait for the client passed to csvdump to finish loading before issuing commands through any of its accessors.
  • Expand list-form client commands correctly in wait_done_loading.
  • Reset the ready-message counter after a port collision so logs from the replacement server are checked from the beginning.
  • Correct the faster-failover retry predicate so it requires both expected replicas to become secondaries.

…eading diagnostics:

- Treat a replica LOADING reply as a pending result while waiting for a value to propagate, but re-raise every other command error instead of masking it.
- Include the replica reply from the final propagation attempt in the timeout diagnostic.
- Wait for the client passed to csvdump to finish loading before issuing commands through any of its accessors.
- Expand list-form client commands correctly in wait_done_loading.
- Reset the ready-message counter after a port collision so logs from the replacement server are checked from the beginning.
- Correct the faster-failover retry predicate so it requires both expected replicas to become secondaries.

Signed-off-by: artikell <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 17c3e0af-b151-4018-8eb2-db4792450768

📥 Commits

Reviewing files that changed from the base of the PR and between 5773e89 and e7aa8f9.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 62dbba01-2ca7-4b4c-b96a-c86231c96d95

📥 Commits

Reviewing files that changed from the base of the PR and between 51b3f0c and 5773e89.

📒 Files selected for processing (4)
  • tests/support/server.tcl
  • tests/support/test.tcl
  • tests/support/util.tcl
  • tests/unit/cluster/faster-failover.tcl

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The changes update test helpers for busy-port startup retries, replica propagation and loading checks, and a cluster failover recovery condition.

Changes

Replica Readiness

Layer / File(s) Summary
Propagation and loading checks
tests/support/test.tcl, tests/support/util.tcl
Replica polling retries on LOADING *, propagates other errors, and captures the latest GET result on timeout. wait_done_loading expands the client command prefix, and csvdump waits for loading to finish.

Server Startup Retry

Layer / File(s) Summary
Busy-port retry
tests/support/server.tcl
start_server resets previous_ready_count before retrying with another port when the selected port is busy.

Cluster Failover Test

Layer / File(s) Summary
Recovery condition
tests/unit/cluster/faster-failover.tcl
The recovery condition joins the R6 and R11 role checks with a single &&.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: enjoy-binbin

Merge Risk: ⚪ Minimal · up to 5773e

The reviewed test-helper and failover changes have no supported merge-blocking risk in the available evidence.

Architecture Summary

Architecture risk: 🔵 Low · up to 5773e

The change affects 1 system.

Changed systems: tests

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — tests (service) was modified; 4 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in tests/support/server.tcl: When a startup attempt finds the port busy, start_server resets previous_ready_count to 0 before retrying with another port.
  • observed — Modified behavior in tests/support/test.tcl: Added replica_value_matches_or_is_loading: it returns false for LOADING * errors, rethrows other errors, and otherwise reports whether the replica value equals the expected value.
  • observed — Modified behavior in tests/support/test.tcl: wait_for_value_to_propagate_to_replica now uses the helper while polling. On timeout, it captures the replica GET result for the error message; previously, the polling expression compared values directly and the timeout message performed another uncaught GET.
  • observed — Modified behavior in tests/support/util.tcl: wait_done_loading now expands the client command prefix when calling ping; previously, it invoked $r as a single command.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately summarizes the test-harness fixes in the changeset, including replica loading handling, command expansion, startup retries, and failover checks.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing test-harness issues that can cause flaky failures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

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.

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.70%. Comparing base (3293091) to head (e7aa8f9).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #4805      +/-   ##
============================================
+ Coverage     80.68%   80.70%   +0.02%     
============================================
  Files           194      194              
  Lines        101154   101154              
============================================
+ Hits          81612    81641      +29     
+ Misses        19542    19513      -29     

see 19 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.

@madolson
madolson merged commit 8afe238 into valkey-io:unstable Oct 30, 2026
65 checks passed
@JimB123 JimB123 moved this from Todo to To be backported in Valkey 9.2 Oct 30, 2026
valkeyrie-ops Bot pushed a commit that referenced this pull request Nov 2, 2026
Fix several test-harness issues that can cause flaky failures or
misleading diagnostics:

- Treat a replica LOADING reply as a pending result while waiting for a
value to propagate, but re-raise every other command error instead of
masking it.
- Include the replica reply from the final propagation attempt in the
timeout diagnostic.
- Wait for the client passed to csvdump to finish loading before issuing
commands through any of its accessors.
- Expand list-form client commands correctly in wait_done_loading.
- Reset the ready-message counter after a port collision so logs from
the replacement server are checked from the beginning.
- Correct the faster-failover retry predicate so it requires both
expected replicas to become secondaries.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
JimB123 pushed a commit that referenced this pull request Nov 3, 2026
Fix several test-harness issues that can cause flaky failures or
misleading diagnostics:

- Treat a replica LOADING reply as a pending result while waiting for a
value to propagate, but re-raise every other command error instead of
masking it.
- Include the replica reply from the final propagation attempt in the
timeout diagnostic.
- Wait for the client passed to csvdump to finish loading before issuing
commands through any of its accessors.
- Expand list-form client commands correctly in wait_done_loading.
- Reset the ready-message counter after a port collision so logs from
the replacement server are checked from the beginning.
- Correct the faster-failover retry predicate so it requires both
expected replicas to become secondaries.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
@valkeyrie-ops valkeyrie-ops Bot moved this from To be backported to Done in Valkey 9.2 Nov 3, 2026
This was referenced Nov 13, 2026
sarthakaggarwal97 pushed a commit to sarthakaggarwal97/valkey that referenced this pull request Nov 17, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit to sarthakaggarwal97/valkey that referenced this pull request Nov 17, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit to sarthakaggarwal97/valkey that referenced this pull request Nov 17, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit to sarthakaggarwal97/valkey that referenced this pull request Nov 17, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit to sarthakaggarwal97/valkey that referenced this pull request Nov 17, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Backport only the port-collision fix from the merged test-harness PR.
When a fixture reuses its log directory, start_server remembers the ready
messages from earlier instances. A bind collision truncates that log before
retrying, so the remembered count must also be reset. Otherwise a healthy
replacement server can wait indefinitely for messages that were removed.

The 9.1 Fedora Rawhide TLS-module Daily reproduced this in integration/aof.
Keep the existing port retry, readiness checks and test assertions. This
changes only the test harness; no server behavior or persistence code changes.

Signed-off-by: artikell <[email protected]>
Backport-Source-PR: 4805
Backport-Source-Commit: 8afe238
Backport-Adaptation: Only the ready-counter fix; other source PR fixes excluded.
CI-Fix-Job: test-fedorarawhide-tls-module
CI-Fix-Run: https://github.com/sarthakaggarwal97/valkey/actions/runs/44083901018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants