Skip to content

Commit 848fa1d

Browse files
jonyoderclaude
andcommitted
Seed store in TestLeaderLeadInternal sweep step for per-sweep reconcile
evaluateHealth now reconciles the in-memory map against the store on every sweep tick, so the sweep step must seed the store with the surviving node. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4bbf985 commit 848fa1d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

pkg/rselection/impls/pgx/leader_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,14 @@ func (s *LeaderSuite) TestLeaderLeadInternal(c *check.C) {
252252
c.Assert(fakeNotifier.msgs, check.HasLen, 4)
253253
c.Assert(leader.nodes, check.HasLen, 2)
254254

255+
// The leader now reconciles the in-memory map against the store on every
256+
// sweep (via evaluateHealth), so seed the store with the node that should
257+
// survive: "one" has a stale ping and is swept; "two" remains and is in the
258+
// store, so it is neither swept nor pruned.
259+
cstore.nodes = map[string]*electiontypes.ClusterNode{
260+
"two": {Name: "two", IP: "192.168.50.12"},
261+
}
262+
255263
// Sweep
256264
wait(loopCh, func() { sweepTick <- time.Now() })
257265
c.Assert(leader.nodes, check.HasLen, 1)

0 commit comments

Comments
 (0)