test: the rejoin failure reports both replicas' log tails

The primary's peer answer alone cannot tell a replica that never caught up
from one that never answered; the failure now carries r2's and r3's logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-30 22:14:22 -08:00
1 parent 6cea6fd674
commit c974574f8a
1 file changed
+8 -3
@@ -191,7 +191,9 @@ func fencingRoundHeal(t *testing.T, rejoin bool) {
// not ready, and the gate then fences once more and continues r1 at the
// next epoch, which is the designed answer to a primary that is not
// ready, not a failure of the rejoin.
epoch := waitRejoinConverged(t, r1.status, 2, "r2", "r3")
epoch := waitRejoinConverged(t, r1.status, 2, func() string {
return "r2 log tail:\n" + r2.d.tail(40) + "\nr3 log tail:\n" + r3.d.tail(40)
}, "r2", "r3")
if epoch > 2 {
t.Logf("a further fencing round continued r1 at epoch %d after the pause", epoch)
}
@@ -210,7 +212,10 @@ func fencingRoundHeal(t *testing.T, rejoin bool) {
// peer at that same e, all read in one pass; it returns e. Reading the epoch
// once and then waiting for that exact epoch would fail if a further round
// moved it in between.
func waitRejoinConverged(t *testing.T, statusAddr string, minEpoch uint64, rids ...string) uint64 {
// On failure it reports the last answer and dump(), the replicas' own logs:
// the primary's answer alone cannot tell a replica that never caught up from
// one that never answered.
func waitRejoinConverged(t *testing.T, statusAddr string, minEpoch uint64, dump func() string, rids ...string) uint64 {
t.Helper()
c := &http.Client{Timeout: 5 * time.Second}
get := func(path string) []byte {
@@ -256,7 +261,7 @@ func waitRejoinConverged(t *testing.T, statusAddr string, minEpoch uint64, rids
return st.Epoch
}
}
t.Fatalf("the primary and %v never converged on one epoch >= %d; last answer: %s", rids, minEpoch, last)
t.Fatalf("the primary and %v never converged on one epoch >= %d; last answer: %s\n%s", rids, minEpoch, last, dump())
return 0
}