test: red: the unsupported path reassigns when the current primary does not answer its status probe

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-24 10:28:00 -08:00
1 parent c7b8c0f78c
commit af8473c561
1 file changed
+22 -1
@@ -64,6 +64,9 @@ func ingestRF3Incarnations(t *testing.T, h *Host, r1, r2, r3 rf3Slot) {
type switchProbe struct {
mu sync.Mutex
currentReady bool
// currentUnknown: the current primary did not answer (status GET
// refused or timed out), so CurrentKnown is false.
currentUnknown bool
// When hold is set, a probe signals entered and then blocks until
// release is closed.
hold bool
@@ -99,7 +102,7 @@ func (p *switchProbe) ProbePromotionCandidates(volumeID string, current authorit
// Only r2 is seen, so its promotion needs a known frontier
// it covers (#181); r3 is silent in these tests.
SyncAckLSN: 70,
CurrentKnown: true,
CurrentKnown: !p.currentUnknown,
Current: PromotionCandidateEvidence{ReplicaID: "r1", Ready: p.currentReady, DurableLSN: 70},
Candidates: []PromotionCandidateEvidence{{ReplicaID: "r2", Ready: true, DurableLSN: 70}},
}, nil
@@ -213,6 +216,24 @@ func TestBootGrace_UnsupportedPathHonorsGraceThenFailsOver(t *testing.T) {
expectFailoverToR2(t, h, "unready past its boot grace")
}
// A current primary that did not answer its status probe is UNKNOWN, not
// failed: the unsupported path never reassigns on it, however ready the
// survivor (an unknown fact is never read as failed). Only a positive
// not-ready report from the primary itself moves the line.
func TestUnsupportedPathNeverReassignsOnAnUnansweredPrimary(t *testing.T) {
h := newBootGraceMaster(t, Config{})
defer closeTestMaster(t, h)
p := probeOf(t, h)
p.mu.Lock()
p.currentUnknown = true
p.mu.Unlock()
unsupportedTick(t, h, readySlot("r1-a"))
expectLineStaysR1(t, h, "status probe of the current primary timed out")
unsupportedTick(t, h, readySlot("r1-a"))
expectLineStaysR1(t, h, "still unanswered on the next tick")
}
// An explicit unhealthy current primary gets no grace on this path.
func TestBootGrace_UnsupportedPathUnhealthyCurrentFailsOverAtOnce(t *testing.T) {
h := newBootGraceMaster(t, Config{})