mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 11:07:31 +01:00
test: cover the authority-line serving path and a node leaving the co-located set
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2134f9ebc3
commit
8f7dd2dd44
2 files changed
+32
No files matched your search
@@ -142,6 +142,25 @@ func TestColocatedNodeIsAlarmedButAcceptedByDefault(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A node that moves its durable root off the authority store's file system
|
||||
// leaves the co-located set on its next heartbeat: strict isolation accepts
|
||||
// it again and no longer refuses new work on it.
|
||||
func TestColocatedNodeLeavesTheSetWhenItMovesOff(t *testing.T) {
|
||||
r := newIsolationRig(t, true, t.TempDir(), t.TempDir())
|
||||
if err := r.heartbeat("node-a", masterStore); status.Code(err) != codes.FailedPrecondition {
|
||||
t.Fatalf("strict heartbeat of a co-located new node: %v, want FailedPrecondition", err)
|
||||
}
|
||||
if !r.m.colocatedTargetRefused("node-a") || r.m.WorkspaceLeaseStatus().ColocatedNodes != 1 {
|
||||
t.Fatal("co-located node not recorded")
|
||||
}
|
||||
if err := r.heartbeat("node-a", storeident.Identity{MachineID: "machine-1", Dev: 2050}); err != nil {
|
||||
t.Fatalf("strict refused the node after it moved off the store's file system: %v", err)
|
||||
}
|
||||
if r.m.colocatedTargetRefused("node-a") || r.m.WorkspaceLeaseStatus().ColocatedNodes != 0 {
|
||||
t.Fatal("node still counted as co-located after it moved off")
|
||||
}
|
||||
}
|
||||
|
||||
// Strict: a co-located node that serves no volume is refused
|
||||
// (FailedPrecondition) and still alarmed; a node elsewhere is accepted.
|
||||
func TestStrictRefusesColocatedNodeWithoutVolumes(t *testing.T) {
|
||||
|
||||
@@ -162,4 +162,17 @@ func TestWorkspaceRPCCleanMovePreservesReplicaIdentity(t *testing.T) {
|
||||
if state := restarted.Publisher().WorkspaceState("vol-a"); state == nil || len(state.Moves) != 1 || !state.Moves[0].Issued {
|
||||
t.Fatal(state)
|
||||
}
|
||||
// Journal isolation reads "serves" from durable state: the issued move's
|
||||
// target serves vol-a through its authority line alone (the placement
|
||||
// still names the old node), also on a restarted master.
|
||||
if p, ok := restarted.Lifecycle().Placements.GetPlacement("vol-a"); ok {
|
||||
for _, slot := range p.Slots {
|
||||
if slot.ServerID == "node-b" {
|
||||
t.Fatalf("placement already names the move target: %+v", p)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !restarted.nodeServesVolumes("node-b") {
|
||||
t.Fatal("the issued move's target does not count as serving vol-a")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user