Keep a plan's backups in the store: a migration and the plan's read and write (issues 1065, 1066)
mesh/repo-check waiting in the build queue since 00:05: asked by the merge tool against trunk 7c9c187ca6e2
mesh/delivery stopped: Operator's word (2026-10-18 00:09): split the group. After mesh-catalog #353 merged on the group's Approve (23:48:51), #375's merg…
mesh/delivery-group group feat/backup-before-send stopped: a member was stopped
mesh/merge-gate building on shanks since 00:10
mesh/repo-check waiting in the build queue since 00:05: asked by the merge tool against trunk 7c9c187ca6e2
mesh/delivery stopped: Operator's word (2026-10-18 00:09): split the group. After mesh-catalog #353 merged on the group's Approve (23:48:51), #375's merg…
mesh/delivery-group group feat/backup-before-send stopped: a member was stopped
mesh/merge-gate building on shanks since 00:10
This commit is contained in:
@@ -198,3 +198,28 @@ func TestASchemaReachIsKeptByBuild(t *testing.T) {
|
||||
t.Fatalf("reach %d %v %v", reach, known, err)
|
||||
}
|
||||
}
|
||||
|
||||
// A plan keeps its backups through the store, timestamps to the nanosecond (novox/hq ADR 0404, issue 1065).
|
||||
func TestAPlanKeepsItsBackupsInTheStore(t *testing.T) {
|
||||
inv := ForTest(t)
|
||||
ctx := t.Context()
|
||||
at := time.Now().UTC()
|
||||
p := Plan{ID: "plan-backups", Repository: "novox/mesh-catalog", Commit: "abc", Created: at, State: PlanBuilding,
|
||||
Tiers: [][]string{{"mail"}}, Modules: map[string]*PlanModule{"mail": {}},
|
||||
Backups: &PlanBackups{State: BackupPending, NoHolder: []string{"bare"},
|
||||
Asked: []PlanBackup{{Machine: "ace", Module: "mail", State: BackupPending, AskedAt: &at}}}}
|
||||
if err := inv.SavePlan(ctx, &p); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got, err := inv.PlanByID(ctx, p.ID)
|
||||
if err != nil || got.Backups == nil || !reflect.DeepEqual(got.Backups, p.Backups) {
|
||||
t.Fatalf("kept %+v (%v), wrote %+v", got.Backups, err, p.Backups)
|
||||
}
|
||||
got.Backups.State = BackupDone
|
||||
if err := inv.SavePlan(ctx, &got); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if again, _ := inv.PlanByID(ctx, p.ID); again.Backups == nil || again.Backups.State != BackupDone {
|
||||
t.Fatalf("the change was not kept: %+v", again.Backups)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user