R-1278: the install page says when a backup of an earlier install is kept and links the restore page (HU and EN). Red-proved. Commit only.
gates / gates (push) Successful in 1m33s
gates / gates (push) Successful in 1m33s
This commit is contained in:
@@ -240,6 +240,26 @@ func (m *Manager) driveOfNamespace(nsRoot string) string {
|
||||
return nsRoot
|
||||
}
|
||||
|
||||
// KeptBackupsFor (R-1278) counts the backups of an EARLIER install of stack that the box keeps: its set-aside units
|
||||
// (D47) and the unit „remove — keep backups" left (a removed app's). The install page names them beside a fresh start.
|
||||
func (m *Manager) KeptBackupsFor(stack string) int {
|
||||
if m == nil || !validMirrorStackName(stack) {
|
||||
return 0
|
||||
}
|
||||
n := 0
|
||||
if m.settings != nil {
|
||||
for _, k := range m.settings.GetKeptCopies() {
|
||||
if k.Kind == KeptKindUnit && k.Source == stack {
|
||||
n++
|
||||
}
|
||||
}
|
||||
}
|
||||
if _, ok := m.RemovedAppUnitFor(stack); ok {
|
||||
n++
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// SetAsideDirsForApp lists the app's set-aside folders (<root>/backups/set-aside/<stack>) that exist, on every
|
||||
// namespace root a unit of it can sit on.
|
||||
func (m *Manager) SetAsideDirsForApp(stack string) []string {
|
||||
|
||||
@@ -373,3 +373,21 @@ func TestR1288_ARestoreOfASetAsideUnitRetiresTheReplacedUnitQuietly(t *testing.T
|
||||
t.Fatalf("the next backup set something aside again: alarms %v, set-aside %v", alarms, r.setAside(t))
|
||||
}
|
||||
}
|
||||
|
||||
// R-1278: the install page's count of an earlier install's kept backups — a set-aside unit counts once per copy.
|
||||
func TestR1278_KeptBackupsForCountsTheSetAsideUnits(t *testing.T) {
|
||||
r := d47Setup(t, "aaaa000000000001")
|
||||
if n := r.m.KeptBackupsFor("tandoor"); n != 0 {
|
||||
t.Fatalf("before any set-aside: %d", n)
|
||||
}
|
||||
r.reinstall("bbbb000000000002")
|
||||
if err := r.m.captureRecoveryUnit("tandoor", false); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if n := r.m.KeptBackupsFor("tandoor"); n != 1 {
|
||||
t.Fatalf("after one set-aside: %d, want 1", n)
|
||||
}
|
||||
if n := r.m.KeptBackupsFor("other"); n != 0 {
|
||||
t.Fatalf("another app counts nothing: %d", n)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user