test: require resumable progress guidance on backup failures

This commit is contained in:
pingqiu committed 2026-11-29 08:18:32 -08:00
1 parent 83cdea1502
commit bb9f6f1207
2 files changed
+7 -3

No files matched your search

@@ -487,7 +487,7 @@ func TestVolumeBackupTakesOneSnapshotAndRerunReplays(t *testing.T) {
// answer lost or unknown: the failure names the same command; running it
// completes with exactly one snapshot.
func TestVolumeBackupInterruptedResumesWithTheSameCommand(t *testing.T) {
for _, c := range []string{"step", "lost", "unknown"} {
for _, c := range []string{"step", "lost", "unknown", "refuse"} {
t.Run(c, func(t *testing.T) {
h := newFakeHost(t)
env := h.env(t)
@@ -504,7 +504,11 @@ func TestVolumeBackupInterruptedResumesWithTheSameCommand(t *testing.T) {
sh.mode = c
}
code, _, errs := runBackup(env, "vol-a", "--name", "nightly")
if code != 1 || !strings.Contains(errs, "run the same command") || !strings.Contains(errs, "sudo sw-block volume backup vol-a --name nightly") {
wantCode := 1
if c == "refuse" {
wantCode = 2
}
if code != wantCode || !strings.Contains(errs, "run the same command") || !strings.Contains(errs, "sudo sw-block volume backup vol-a --name nightly") || !strings.Contains(errs, "keeps what it uploaded") {
t.Fatalf("interrupted backup: %d %s", code, errs)
}
env.Step, sh.mode = nil, ""
@@ -685,7 +685,7 @@ func TestVolumeStopPrintsTheTimeTakenBeforeTheCut(t *testing.T) {
func TestVolumeTextsForTimeoutsAndNewVolumes(t *testing.T) {
h, env := startedHost(t, true)
h.cutMode.Store("hang")
if _, _, errs := runStop(env, stopOpts{Volume: "vol-a", Timeout: 100 * time.Millisecond}); !strings.Contains(errs, "keeps what it uploaded") {
if _, _, errs := runStop(env, stopOpts{Volume: "vol-a", Timeout: 100 * time.Millisecond}); !strings.Contains(errs, "keeps what it uploaded") || !strings.Contains(errs, "running the same command again continues from it") {
t.Fatalf("timed-out cut: %s", errs)
}
if !strings.Contains(volumeHelp(), "cluster spec and restart blockmaster") {