Browse Source

fix: tighten FC1 new-session assertion and FC4 proof-detail check

FC1: now asserts HasActiveSession() after address change AND
verifies session_created in log (not just plan_cancelled).

FC4: escalation event detail must be >15 chars (contains proof
reason with LSN values, not just "needs_rebuild").

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feature/sw-block
pingqiu 2 days ago
parent
commit
cd8bfb21d4
  1. 22
      weed/storage/blockvol/v2bridge/failure_replay_test.go

22
weed/storage/blockvol/v2bridge/failure_replay_test.go

@ -94,15 +94,27 @@ func TestP2_FC1_ChangedAddress(t *testing.T) {
t.Fatalf("FC1: endpoint not updated: %s", senderAfter.Endpoint().DataAddr)
}
// Verify new session was created after address change.
if !senderAfter.HasActiveSession() {
t.Fatal("FC1: new session must be created after address change")
}
hasCancelled := false
hasNewSession := false
for _, e := range driver.Orchestrator.Log.EventsFor("vol1/vs2") {
if e.Event == "plan_cancelled" {
hasCancelled = true
}
if e.Event == "session_created" {
hasNewSession = true
}
}
if !hasCancelled {
t.Fatal("FC1: log must show plan_cancelled")
}
if !hasNewSession {
t.Fatal("FC1: log must show session_created after address change")
}
}
// --- FC2: Stale epoch after failover (integrated engine/storage, control simulated) ---
@ -231,13 +243,21 @@ func TestP2_FC4_UnrecoverableGap_Forced(t *testing.T) {
}
hasEscalation := false
hasProofDetail := false
for _, e := range driver.Orchestrator.Log.EventsFor("vol1/vs2") {
if e.Event == "escalated" {
hasEscalation = true
// Detail must contain the proof reason with LSN values.
if len(e.Detail) > 15 {
hasProofDetail = true
}
}
}
if !hasEscalation {
t.Fatal("FC4: log must show escalation with gap details")
t.Fatal("FC4: log must show escalation event")
}
if !hasProofDetail {
t.Fatal("FC4: escalation event must contain proof reason with LSN details")
}
t.Logf("FC4: NeedsRebuild proven — replica=0, tail=%d, proof=%s",
state.WALTailLSN, plan.Proof.Reason)

Loading…
Cancel
Save