Keep a no-holder machine as ADR 0404 says; prove the cut takes the backups before its first tier (issue 1086, review round 1)
mesh/merge-gate head b6f8aef4d4f1 merged into trunk 47f9290b37aa — pass: builds mesh-controller → novox; no bus step; every machine composes with the chang…
mesh/repo-check head b6f8aef4d4f1 merged into trunk 47f9290b37aa — pass: its merge-check.sh passed
mesh/delivery delivered

This commit is contained in:
2026-10-18 01:57:00 +02:00
parent 7103e33294
commit b6f8aef4d4
3 changed files with 98 additions and 32 deletions
+8 -26
View File
@@ -111,8 +111,8 @@ func TestOnlyModulesWithAnItemProtectedByABackupAreAsked(t *testing.T) {
}
}
// A machine with no backup holder cannot be asked: the plan holds and says so, and asks nothing (issue 1086).
func TestANodeWithNoBackupHolderHoldsThePlanAndSaysSo(t *testing.T) {
// A machine with no backup holder is asked nothing, the plan says so, and it does not hold the plan.
func TestANodeWithNoBackupHolderAsksNothingAndThePlanSaysSo(t *testing.T) {
seat := &aFakeBackupSeat{}
seat.install(t)
entries := []inventory.Entry{aModuleWith(t, "copied", []string{"ace", "bare"}, anItem("a", ""))}
@@ -121,17 +121,17 @@ func TestANodeWithNoBackupHolderHoldsThePlanAndSaysSo(t *testing.T) {
if err != nil || proceed {
t.Fatalf("proceed=%v err=%v", proceed, err)
}
if len(seat.asked) != 0 {
t.Fatalf("a held plan asks nothing: %v", seat.asked)
if strings.Join(seat.asked, " ") != "ace/copied" {
t.Fatalf("asked %v", seat.asked)
}
if p.Backups == nil || len(p.Backups.NoHolder) != 1 || p.Backups.NoHolder[0] != "bare" ||
p.Backups.State != inventory.BackupFailed || !strings.Contains(p.Note, "copied on bare") {
t.Fatalf("the plan must hold and say bare has no holder: %+v note %q", p.Backups, p.Note)
if p.Backups == nil || len(p.Backups.NoHolder) != 1 || p.Backups.NoHolder[0] != "bare" {
t.Fatalf("the plan must say bare has no holder: %+v", p.Backups)
}
// Only the no-holder machine: nothing to wait for, the plan goes on, and still says it.
only := []inventory.Entry{aModuleWith(t, "copied", []string{"bare"}, anItem("a", ""))}
q := aPlanOf("copied")
proceed, err = stepBackups(t.Context(), q, backupFactsFrom(only, holders("ace")), backupT0)
if err != nil || proceed || q.Backups.State != inventory.BackupFailed {
if err != nil || !proceed || q.Backups == nil || q.Backups.NoHolder[0] != "bare" || q.Backups.State != inventory.BackupDone {
t.Fatalf("proceed=%v err=%v record=%+v", proceed, err, q.Backups)
}
}
@@ -264,24 +264,6 @@ func TestACutPlanAsksTheBackupOfGiteaOnNovoxBeforeItAsksItsFirstTier(t *testing.
}
}
func TestACutPlanHoldsWhenTheMachineItSendsDataToHasNoBackupHolder(t *testing.T) {
seat := &aFakeBackupSeat{}
seat.install(t)
facts := backupFactsFrom([]inventory.Entry{giteaOnNovox(t)}, holders("ace"))
p := aPlanOf("gitea")
tierAsked := false
err := askFirstTierAtCut(p,
func(p *inventory.Plan) (bool, error) { return stepBackups(t.Context(), p, facts, backupT0) },
func() error { tierAsked = true; return nil })
if err != nil || tierAsked {
t.Fatalf("asked=%v err=%v", tierAsked, err)
}
if p.Backups == nil || p.Backups.State != inventory.BackupFailed || !strings.Contains(p.Note, "novox") ||
!strings.Contains(p.Note, "held") {
t.Fatalf("the plan must hold and say so: %+v note %q", p.Backups, p.Note)
}
}
func TestACutPlanWhoseBackupsCouldNotBeWorkedOutAsksNothingAndSaysSo(t *testing.T) {
p := aPlanOf("gitea")
tierAsked := false