Skip to content

Improve CLUSTERSCAN error handling test with broader coverage#3674

Merged
enjoy-binbin merged 1 commit into
valkey-io:unstablefrom
enjoy-binbin:cleanup_test
May 13, 2026
Merged

Improve CLUSTERSCAN error handling test with broader coverage#3674
enjoy-binbin merged 1 commit into
valkey-io:unstablefrom
enjoy-binbin:cleanup_test

Conversation

@enjoy-binbin
Copy link
Copy Markdown
Member

Rewrite the CLUSTERDOWN test to use a 3-node cluster and cover four
distinct degraded-cluster scenarios:

  1. Node down with full-coverage enabled -> CLUSTERDOWN on all slots
  2. Node down with full-coverage disabled -> MOVED for unreachable
    slots, local slots handled normally
  3. Slot unassigned with full-coverage enabled -> "Hash slot not served"
    for the unassigned slot, CLUSTERDOWN for others
  4. Slot unassigned with full-coverage disabled -> "Hash slot not served"
    for the unassigned slot, MOVED for remote slots

Rewrite the CLUSTERDOWN test to use a 3-node cluster and cover four
distinct degraded-cluster scenarios:
1. Node down with full-coverage enabled -> CLUSTERDOWN on all slots
2. Node down with full-coverage disabled -> MOVED for unreachable
   slots, local slots handled normally
3. Slot unassigned with full-coverage enabled -> "Hash slot not served"
   for the unassigned slot, CLUSTERDOWN for others
4. Slot unassigned with full-coverage disabled -> "Hash slot not served"
   for the unassigned slot, MOVED for remote slots

Signed-off-by: Binbin <binloveplay1314@qq.com>
@enjoy-binbin
Copy link
Copy Markdown
Member Author

@nmvk I noticed this test while working on other changes, would you be able to take a look and review it?

set slot0_owner -1
foreach n {0 1} {
if {[catch {R $n clusterscan 0-{06S}-0 SLOT 0} res] == 0} {
set cursor_slot_0 [lindex $res 0]
Copy link
Copy Markdown
Member Author

@enjoy-binbin enjoy-binbin May 12, 2026

Choose a reason for hiding this comment

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

This actually returns {0 {}} in the old code, so cursor_slot_0 is 0, and in the wait condition, we are actually checking R 0 clusterscan 0.

I'm wondering if we should return "cluster down" for this. See the other PR (#3675) for more info

127.0.0.1:30001> clusterscan 0
1) "0-{06S}-0"
2) (empty array)
127.0.0.1:30001> clusterscan 0-{06S}-0
(error) CLUSTERDOWN The cluster is down

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.54%. Comparing base (ca9dee3) to head (de63e74).
⚠️ Report is 1 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #3674      +/-   ##
============================================
- Coverage     76.71%   76.54%   -0.18%     
============================================
  Files           162      162              
  Lines         80656    80654       -2     
============================================
- Hits          61872    61733     -139     
- Misses        18784    18921     +137     

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

Copy link
Copy Markdown
Contributor

@nmvk nmvk left a comment

Choose a reason for hiding this comment

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

Thank you @enjoy-binbin for adding the test with broader coverage

Copy link
Copy Markdown
Member

@madolson madolson left a comment

Choose a reason for hiding this comment

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

More tests are always good :)

@enjoy-binbin enjoy-binbin merged commit a813df0 into valkey-io:unstable May 13, 2026
62 checks passed
@enjoy-binbin enjoy-binbin deleted the cleanup_test branch May 13, 2026 03:39
lucasyonge pushed a commit that referenced this pull request May 14, 2026
Rewrite the CLUSTERDOWN test to use a 3-node cluster and cover four
distinct degraded-cluster scenarios:
1. Node down with full-coverage enabled -> CLUSTERDOWN on all slots
2. Node down with full-coverage disabled -> MOVED for unreachable
   slots, local slots handled normally
3. Slot unassigned with full-coverage enabled -> "Hash slot not served"
   for the unassigned slot, CLUSTERDOWN for others
4. Slot unassigned with full-coverage disabled -> "Hash slot not served"
   for the unassigned slot, MOVED for remote slots

Signed-off-by: Binbin <binloveplay1314@qq.com>
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.

3 participants