| index 3ae90a02d..e91be1486 100644 |
| --- a/move_test.go |
| +++ b/move_test.go |
| @@ -1097,7 +1097,11 @@ func TestMoveStatusSaysWhyTheCutDidNotStart(t *testing.T) { |
| |
| // ---- carlos move offline ---- |
| |
| -const tOfflinePth = tMovePth + "/offline" |
| +// tOffMovePth is the move door of the offline tests' instance, oHost of the |
| +// app shop. |
| +const tOffMovePth = "/api/cli/apps/bab/shop/instances/" + oHost + "/move" |
| + |
| +const tOfflinePth = tOffMovePth + "/offline" |
| |
| // offPost is one scripted answer of a mutating door; the last one repeats. |
| type offPost struct { |
| @@ -1127,7 +1131,7 @@ func (c *fakeOfflineConsole) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| _ = json.NewEncoder(w).Encode(v) |
| } |
| body, _ := io.ReadAll(r.Body) |
| - c.log = append(c.log, r.Method+" "+strings.TrimPrefix(r.URL.Path, tMovePth)+" "+strings.TrimSpace(string(body))) |
| + c.log = append(c.log, r.Method+" "+strings.TrimPrefix(r.URL.Path, tOffMovePth)+" "+strings.TrimSpace(string(body))) |
| if !strings.HasPrefix(r.URL.Path, tOfflinePth) { |
| http.NotFound(w, r) |
| return |
| @@ -1185,7 +1189,7 @@ func runOfflineAgainst(t *testing.T, c *fakeOfflineConsole, args ...string) (int |
| stdin: strings.NewReader(""), |
| } |
| args = append([]string{"offline"}, args...) |
| - args = append(args, "--host", tHost, "--account", "bab", "--app", "titogo") |
| + args = append(args, "--host", oHost, "--account", "bab", "--app", "shop") |
| ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) |
| defer cancel() |
| code := moveMain(ctx, args, &out, deps) |
| @@ -1194,7 +1198,7 @@ func runOfflineAgainst(t *testing.T, c *fakeOfflineConsole, args ...string) (int |
| |
| // offView is the offline status view of a move in state, as T6 builds it. |
| func offView(state string, extra frame) frame { |
| - f := frame{"host": tHost, "state": state, "id": tMoveID, "from": "ie", "to": "uk", |
| + f := frame{"host": oHost, "state": state, "id": tMoveID, "from": "ie", "to": "uk", |
| "sealer": "ie-box", "boxes": []string{"ie-box"}} |
| for k, v := range extra { |
| f[k] = v |
| @@ -1203,7 +1207,7 @@ func offView(state string, extra frame) frame { |
| } |
| |
| func offDone(outcome string, offlineS float64) frame { |
| - return frame{"host": tHost, "state": "none", |
| + return frame{"host": oHost, "state": "none", |
| "last": frame{"id": tMoveID, "outcome": outcome, "at": "2026-10-20T10:00:00Z", "offline_s": offlineS}} |
| } |
| |
| @@ -1212,19 +1216,19 @@ func offReport(box, role, phase string, fresh bool) frame { |
| } |
| |
| const ( |
| - oHost = "acme.go.tito.io" |
| + oHost = "acme.shop.example.com" |
| |
| - oStarting = "Moving acme.go.tito.io from ie to uk." |
| - oOffline = "acme.go.tito.io is offline from now until the move opens or is aborted." |
| - oStopped = "Every box in ie has stopped acme.go.tito.io. Run carlos move offline seal --host acme.go.tito.io to copy it." |
| - oCopying = "Copying acme.go.tito.io to uk." |
| - oCopied = "Copied and checked. Run carlos move offline flip --host acme.go.tito.io to start it in uk." |
| + oStarting = "Moving acme.shop.example.com from ie to uk." |
| + oOffline = "acme.shop.example.com is offline from now until the move opens or is aborted." |
| + oStopped = "Every box in ie has stopped acme.shop.example.com. Run carlos move offline seal --host acme.shop.example.com to copy it." |
| + oCopying = "Copying acme.shop.example.com to uk." |
| + oCopied = "Copied and checked. Run carlos move offline flip --host acme.shop.example.com to start it in uk." |
| oFlipped = "Stopped in ie. Starting in uk." |
| - oLanded = "uk holds everything acme.go.tito.io needs. Nothing is served yet. Run carlos move offline open --host acme.go.tito.io to serve it from uk." |
| - oServed = "acme.go.tito.io is served from uk. Run carlos move offline finish --host acme.go.tito.io once ie has cleaned up." |
| - oBack = "Moving acme.go.tito.io back to ie." |
| - oPutBack = "Every box has put acme.go.tito.io back in ie. Run carlos move offline finish --host acme.go.tito.io to end the move." |
| - oWaitBox = "Waiting for ie-box in ie to confirm it has stopped acme.go.tito.io. acme.go.tito.io is offline." |
| + oLanded = "uk holds everything acme.shop.example.com needs. Nothing is served yet. Run carlos move offline open --host acme.shop.example.com to serve it from uk." |
| + oServed = "acme.shop.example.com is served from uk. Run carlos move offline finish --host acme.shop.example.com once ie has cleaned up." |
| + oBack = "Moving acme.shop.example.com back to ie." |
| + oPutBack = "Every box has put acme.shop.example.com back in ie. Run carlos move offline finish --host acme.shop.example.com to end the move." |
| + oWaitBox = "Waiting for ie-box in ie to confirm it has stopped acme.shop.example.com. acme.shop.example.com is offline." |
| ) |
| |
| func TestParseMoveArgsOffline(t *testing.T) { |
| @@ -1233,21 +1237,21 @@ func TestParseMoveArgsOffline(t *testing.T) { |
| ok bool |
| sub string |
| }{ |
| - {[]string{"offline", "start", "--host", tHost, "--to", "uk"}, true, "start"}, |
| - {[]string{"offline", "seal", "--host", tHost}, true, "seal"}, |
| - {[]string{"offline", "flip", "--host", tHost}, true, "flip"}, |
| - {[]string{"offline", "open", "--host", tHost}, true, "open"}, |
| - {[]string{"offline", "finish", "--host", tHost}, true, "finish"}, |
| - {[]string{"offline", "abort", "--host", tHost}, true, "abort"}, |
| - {[]string{"offline", "status", "--host", tHost, "--app", "x", "--account", "y"}, true, "status"}, |
| - {[]string{"offline", "start", "--host", tHost}, false, ""}, |
| + {[]string{"offline", "start", "--host", oHost, "--to", "uk"}, true, "start"}, |
| + {[]string{"offline", "seal", "--host", oHost}, true, "seal"}, |
| + {[]string{"offline", "flip", "--host", oHost}, true, "flip"}, |
| + {[]string{"offline", "open", "--host", oHost}, true, "open"}, |
| + {[]string{"offline", "finish", "--host", oHost}, true, "finish"}, |
| + {[]string{"offline", "abort", "--host", oHost}, true, "abort"}, |
| + {[]string{"offline", "status", "--host", oHost, "--app", "x", "--account", "y"}, true, "status"}, |
| + {[]string{"offline", "start", "--host", oHost}, false, ""}, |
| {[]string{"offline", "start", "--to", "uk"}, false, ""}, |
| - {[]string{"offline", "seal", "--host", tHost, "--to", "uk"}, false, ""}, |
| - {[]string{"offline", "seal", "--host", tHost, "--no-wait"}, false, ""}, |
| - {[]string{"offline", "seal", "--host", tHost, "extra"}, false, ""}, |
| + {[]string{"offline", "seal", "--host", oHost, "--to", "uk"}, false, ""}, |
| + {[]string{"offline", "seal", "--host", oHost, "--no-wait"}, false, ""}, |
| + {[]string{"offline", "seal", "--host", oHost, "extra"}, false, ""}, |
| {[]string{"offline"}, false, ""}, |
| - {[]string{"offline", "cut", "--host", tHost}, false, ""}, |
| - {[]string{"offline", "--host", tHost}, false, ""}, |
| + {[]string{"offline", "cut", "--host", oHost}, false, ""}, |
| + {[]string{"offline", "--host", oHost}, false, ""}, |
| } { |
| got, err := parseMoveArgs(c.args, io.Discard) |
| if (err == nil) != c.ok || (c.ok && (got.verb != "offline" || got.offline != c.sub)) { |
| @@ -1255,15 +1259,15 @@ func TestParseMoveArgsOffline(t *testing.T) { |
| } |
| } |
| var out bytes.Buffer |
| - if _, err := parseMoveArgs([]string{"offline", "cut", "--host", tHost}, &out); err == nil { |
| + if _, err := parseMoveArgs([]string{"offline", "cut", "--host", oHost}, &out); err == nil { |
| t.Fatal("an unknown offline verb parsed") |
| } |
| wantLines(t, out.String(), "carlos move offline needs start, seal, flip, open, finish, abort or status.") |
| out.Reset() |
| - _, _ = parseMoveArgs([]string{"offline", "start", "--host", tHost}, &out) |
| + _, _ = parseMoveArgs([]string{"offline", "start", "--host", oHost}, &out) |
| wantLines(t, out.String(), "carlos move needs --to <region>.") |
| // The Phase 1 verbs are untouched. |
| - if got, err := parseMoveArgs([]string{"abort", "--host", tHost}, io.Discard); err != nil || got.verb != "abort" || got.offline != "" { |
| + if got, err := parseMoveArgs([]string{"abort", "--host", oHost}, io.Discard); err != nil || got.verb != "abort" || got.offline != "" { |
| t.Errorf("carlos move abort = %+v, %v", got, err) |
| } |
| } |
| @@ -1327,7 +1331,7 @@ func TestMoveOfflineRefusals(t *testing.T) { |
| } |
| |
| func TestMoveOfflineSeal(t *testing.T) { |
| - proc := "ie-box still runs a process for acme.go.tito.io. wait for it to stop, then flip" |
| + proc := "ie-box still runs a process for acme.shop.example.com. wait for it to stop, then flip" |
| c := &fakeOfflineConsole{ |
| posts: map[string][]offPost{"/seal": {{202, offView("offline-sealing", nil)}}}, |
| gets: []frame{ |
| @@ -1356,11 +1360,11 @@ func TestMoveOfflineSealFails(t *testing.T) { |
| extra frame |
| say string |
| }{ |
| - {"item", frame{"items": []frame{item("ok", ""), item("failed", "a file over 256 MiB")}}, "The move could not finish a step: a file over 256 MiB. Run carlos move offline status --host acme.go.tito.io for each item."}, |
| - {"item without detail", frame{"items": []frame{item("failed", "")}}, "The move could not finish a step: files. Run carlos move offline status --host acme.go.tito.io for each item."}, |
| + {"item", frame{"items": []frame{item("ok", ""), item("failed", "a file over 256 MiB")}}, "The move could not finish a step: a file over 256 MiB. Run carlos move offline status --host acme.shop.example.com for each item."}, |
| + {"item without detail", frame{"items": []frame{item("failed", "")}}, "The move could not finish a step: files. Run carlos move offline status --host acme.shop.example.com for each item."}, |
| {"failed flag and report", frame{"failed": true, "reports": []frame{{"box": "ie-box", "role": "sealer", "phase": "failed", "fresh": true, |
| "items": frame{"db": frame{"ok": true, "reason": ""}, "files": frame{"ok": false, "reason": "special file in the archive"}}}}}, |
| - "The move could not finish a step: special file in the archive. Run carlos move offline status --host acme.go.tito.io for each item."}, |
| + "The move could not finish a step: special file in the archive. Run carlos move offline status --host acme.shop.example.com for each item."}, |
| } { |
| t.Run(c.name, func(t *testing.T) { |
| f := &fakeOfflineConsole{ |
| @@ -1380,12 +1384,12 @@ func TestMoveOfflineFlip(t *testing.T) { |
| posts: map[string][]offPost{"/flip": {{202, offView("offline-landing", nil)}}}, |
| gets: []frame{ |
| offView("offline-landing", nil), |
| - offView("offline-landed", frame{"waiting": "this move is offline-landed. run carlos move offline status --host acme.go.tito.io to see what it waits for"}), |
| + offView("offline-landed", frame{"waiting": "this move is offline-landed. run carlos move offline status --host acme.shop.example.com to see what it waits for"}), |
| offView("offline-landed", frame{"next": "open"}), |
| }, |
| } |
| code, out := runOfflineAgainst(t, c, "flip") |
| - want := oFlipped + "\nthis move is offline-landed. run carlos move offline status --host acme.go.tito.io to see what it waits for\n" + oLanded + "\n" |
| + want := oFlipped + "\nthis move is offline-landed. run carlos move offline status --host acme.shop.example.com to see what it waits for\n" + oLanded + "\n" |
| if code != 0 || out != want { |
| t.Fatalf("exit %d, output:\n%s\nwant:\n%s", code, out, want) |
| } |
| @@ -1398,11 +1402,11 @@ func TestMoveOfflineFlipFails(t *testing.T) { |
| extra frame |
| say string |
| }{ |
| - {"item", frame{"items": []frame{failedItem}}, "uk could not take acme.go.tito.io: the listing differs. Run carlos move offline abort --host acme.go.tito.io to move it back."}, |
| + {"item", frame{"items": []frame{failedItem}}, "uk could not take acme.shop.example.com: the listing differs. Run carlos move offline abort --host acme.shop.example.com to move it back."}, |
| {"failed flag, check in the report", frame{"failed": true, "reports": []frame{{"box": "uk-box", "role": "target", "phase": "failed", "fresh": true, |
| "items": frame{"env-pin": frame{"ok": false, "reason": "the app settings differ"}}}}}, |
| - "uk could not take acme.go.tito.io: the app settings differ. Run carlos move offline abort --host acme.go.tito.io to move it back."}, |
| - {"failed flag only", frame{"failed": true}, "uk could not take acme.go.tito.io: failed. Run carlos move offline abort --host acme.go.tito.io to move it back."}, |
| + "uk could not take acme.shop.example.com: the app settings differ. Run carlos move offline abort --host acme.shop.example.com to move it back."}, |
| + {"failed flag only", frame{"failed": true}, "uk could not take acme.shop.example.com: failed. Run carlos move offline abort --host acme.shop.example.com to move it back."}, |
| } { |
| t.Run(c.name, func(t *testing.T) { |
| f := &fakeOfflineConsole{ |
| @@ -1434,7 +1438,7 @@ func TestMoveOfflineOpen(t *testing.T) { |
| } |
| code, out := runOfflineAgainst(t, c, "open") |
| // The served line waits for the target's opened report. |
| - want := "Waiting for ie-box to clean up acme.go.tito.io.\n" + oServed + "\n" |
| + want := "Waiting for ie-box to clean up acme.shop.example.com.\n" + oServed + "\n" |
| if code != 0 || out != want { |
| t.Fatalf("exit %d, output:\n%s\nwant:\n%s", code, out, want) |
| } |
| @@ -1443,7 +1447,7 @@ func TestMoveOfflineOpen(t *testing.T) { |
| posts: map[string][]offPost{"/open": {{202, offView("offline-open", nil)}}}, |
| gets: []frame{offView("offline-open", frame{"next": "finish"})}, |
| } |
| - if code, out := runOfflineAgainst(t, c, "open"); code != 0 || out != "Waiting for ie-box to clean up acme.go.tito.io.\n"+oServed+"\n" { |
| + if code, out := runOfflineAgainst(t, c, "open"); code != 0 || out != "Waiting for ie-box to clean up acme.shop.example.com.\n"+oServed+"\n" { |
| t.Fatalf("exit %d, output:\n%s", code, out) |
| } |
| } |
| @@ -1465,7 +1469,7 @@ func TestMoveOfflineFinishPostsTwice(t *testing.T) { |
| }, |
| } |
| code, out := runOfflineAgainst(t, c, "finish") |
| - want := "Waiting for ie-box to clean up acme.go.tito.io.\nMoved. acme.go.tito.io is served from uk. It was offline for 1800 seconds.\n" |
| + want := "Waiting for ie-box to clean up acme.shop.example.com.\nMoved. acme.shop.example.com is served from uk. It was offline for 1800 seconds.\n" |
| if code != 0 || out != want { |
| t.Fatalf("exit %d, output:\n%s\nwant:\n%s", code, out, want) |
| } |
| @@ -1484,7 +1488,7 @@ func TestMoveOfflineFinishWaitsBeforeThePost(t *testing.T) { |
| }, |
| } |
| code, out := runOfflineAgainst(t, c, "finish") |
| - if code != 0 || !strings.HasSuffix(out, "It was offline for 12 seconds.\n") || !strings.HasPrefix(out, "Waiting for ie-box to clean up acme.go.tito.io.\n") { |
| + if code != 0 || !strings.HasSuffix(out, "It was offline for 12 seconds.\n") || !strings.HasPrefix(out, "Waiting for ie-box to clean up acme.shop.example.com.\n") { |
| t.Fatalf("exit %d:\n%s", code, out) |
| } |
| reqs := c.requests() |
| @@ -1505,7 +1509,7 @@ func TestMoveOfflineFinishAfterAbort(t *testing.T) { |
| gets: []frame{offView("offline-reverting", frame{"next": "finish"})}, |
| } |
| code, out := runOfflineAgainst(t, c, "finish") |
| - if want := "acme.go.tito.io is back in ie and serving. Nothing was lost.\n"; code != 3 || out != want { |
| + if want := "acme.shop.example.com is back in ie and serving. Nothing was lost.\n"; code != 3 || out != want { |
| t.Fatalf("exit %d, output:\n%s\nwant 3:\n%s", code, out, want) |
| } |
| if c.posted("/finish") != 1 { |
| @@ -1516,15 +1520,15 @@ func TestMoveOfflineFinishAfterAbort(t *testing.T) { |
| func TestMoveOfflineFinishRefusedAndOutcomeNotRecorded(t *testing.T) { |
| // Nothing in flight: the door's own sentence, exit 5. |
| c := &fakeOfflineConsole{ |
| - posts: map[string][]offPost{"/finish": {{409, frame{"error": "acme.go.tito.io has no offline move in flight"}}}}, |
| - gets: []frame{{"host": tHost, "state": "none"}}, |
| + posts: map[string][]offPost{"/finish": {{409, frame{"error": "acme.shop.example.com has no offline move in flight"}}}}, |
| + gets: []frame{{"host": oHost, "state": "none"}}, |
| } |
| - if code, out := runOfflineAgainst(t, c, "finish"); code != 5 || out != "acme.go.tito.io has no offline move in flight\n" { |
| + if code, out := runOfflineAgainst(t, c, "finish"); code != 5 || out != "acme.shop.example.com has no offline move in flight\n" { |
| t.Fatalf("exit %d:\n%s", code, out) |
| } |
| // An outcome that is another move's is not this move's. |
| c = &fakeOfflineConsole{ |
| - posts: map[string][]offPost{"/finish": {{202, frame{"host": tHost, "state": "none", "last": frame{"id": "mv_other", "outcome": "done"}}}}}, |
| + posts: map[string][]offPost{"/finish": {{202, frame{"host": oHost, "state": "none", "last": frame{"id": "mv_other", "outcome": "done"}}}}}, |
| gets: []frame{offView("offline-reverting", frame{"next": "finish"})}, |
| } |
| if code, out := runOfflineAgainst(t, c, "finish"); code != 4 || out != "This move's outcome is not recorded.\n" { |
| @@ -1541,7 +1545,7 @@ func TestMoveOfflineAbort(t *testing.T) { |
| }, |
| } |
| code, out := runOfflineAgainst(t, c, "abort") |
| - want := oBack + "\nWaiting for ie-box to clean up acme.go.tito.io.\n" + oPutBack + "\n" |
| + want := oBack + "\nWaiting for ie-box to clean up acme.shop.example.com.\n" + oPutBack + "\n" |
| if code != 3 || out != want { |
| t.Fatalf("exit %d, output:\n%s\nwant 3:\n%s", code, out, want) |
| } |
| @@ -1549,8 +1553,8 @@ func TestMoveOfflineAbort(t *testing.T) { |
| t.Error("abort ran finish by itself") |
| } |
| // Once open, the door refuses and the CLI says so as sent. |
| - c = &fakeOfflineConsole{posts: map[string][]offPost{"/abort": {{409, frame{"error": "acme.go.tito.io is already served from uk. move it back with a new move"}}}}} |
| - if code, out := runOfflineAgainst(t, c, "abort"); code != 5 || out != "acme.go.tito.io is already served from uk. move it back with a new move\n" { |
| + c = &fakeOfflineConsole{posts: map[string][]offPost{"/abort": {{409, frame{"error": "acme.shop.example.com is already served from uk. move it back with a new move"}}}}} |
| + if code, out := runOfflineAgainst(t, c, "abort"); code != 5 || out != "acme.shop.example.com is already served from uk. move it back with a new move\n" { |
| t.Fatalf("exit %d:\n%s", code, out) |
| } |
| } |
| @@ -1563,7 +1567,7 @@ func TestMoveOfflineOvertaken(t *testing.T) { |
| gets: []frame{offView("offline-reverting", nil)}, |
| } |
| code, out := runOfflineAgainst(t, c, "seal") |
| - if want := oCopying + "\n" + oStarting + "\n" + oBack + "\nWaiting for ie-box to clean up acme.go.tito.io.\n"; code != 4 || out != want { |
| + if want := oCopying + "\n" + oStarting + "\n" + oBack + "\nWaiting for ie-box to clean up acme.shop.example.com.\n"; code != 4 || out != want { |
| t.Fatalf("exit %d, output:\n%s\nwant 4:\n%s", code, out, want) |
| } |
| } |
| @@ -1591,7 +1595,7 @@ func TestMoveOfflineStatus(t *testing.T) { |
| // A failed item is the operator's: exit 4. |
| c = &fakeOfflineConsole{gets: []frame{offView("offline-landing", frame{"items": []frame{{"id": "db", "owner": "landing", "status": "failed", "detail": "digest differs"}}})}} |
| code, out = runOfflineAgainst(t, c, "status") |
| - wantF := oStarting + "\nuk could not take acme.go.tito.io: digest differs. Run carlos move offline abort --host acme.go.tito.io to move it back.\nItem db is failed: digest differs.\n" |
| + wantF := oStarting + "\nuk could not take acme.shop.example.com: digest differs. Run carlos move offline abort --host acme.shop.example.com to move it back.\nItem db is failed: digest differs.\n" |
| if code != 4 || out != wantF { |
| t.Fatalf("exit %d, output:\n%s\nwant 4:\n%s", code, out, wantF) |
| } |
| @@ -1603,12 +1607,12 @@ func TestMoveOfflineStatus(t *testing.T) { |
| } |
| |
| // Nothing in flight. |
| - c = &fakeOfflineConsole{gets: []frame{{"host": tHost, "state": "none"}}} |
| - if code, out := runOfflineAgainst(t, c, "status"); code != 0 || out != "No move is in flight for acme.go.tito.io.\n" { |
| + c = &fakeOfflineConsole{gets: []frame{{"host": oHost, "state": "none"}}} |
| + if code, out := runOfflineAgainst(t, c, "status"); code != 0 || out != "No move is in flight for acme.shop.example.com.\n" { |
| t.Fatalf("exit %d:\n%s", code, out) |
| } |
| c = &fakeOfflineConsole{gets: []frame{offDone("done", 5)}} |
| - if code, out := runOfflineAgainst(t, c, "status"); code != 0 || out != "Move "+tMoveID+" of acme.go.tito.io is done.\n" { |
| + if code, out := runOfflineAgainst(t, c, "status"); code != 0 || out != "Move "+tMoveID+" of acme.shop.example.com is done.\n" { |
| t.Fatalf("exit %d:\n%s", code, out) |
| } |
| } |
| @@ -1618,7 +1622,7 @@ func TestMoveOfflineWaitingAfterOpenAndAbort(t *testing.T) { |
| c := &fakeOfflineConsole{gets: []frame{offView("offline-finishing", frame{ |
| "reports": []frame{offReport("ie-box", "source", "gone", true), offReport("ie-box", "sealer", "sealed", true)}})}} |
| code, out := runOfflineAgainst(t, c, "status") |
| - want := oStarting + "\n" + oServed + "\nWaiting for ie-box to clean up acme.go.tito.io.\n" + |
| + want := oStarting + "\n" + oServed + "\nWaiting for ie-box to clean up acme.shop.example.com.\n" + |
| "ie-box is gone as the source.\nie-box is sealed as the sealer.\n" |
| if code != 0 || out != want { |
| t.Fatalf("exit %d, output:\n%s\nwant:\n%s", code, out, want) |
| @@ -1629,12 +1633,12 @@ func TestMoveOfflineNeedsNoPhase1AndRefusesRoot(t *testing.T) { |
| // The Phase 1 door is never read: the fake 404s everything outside |
| // /move/offline, and the verb still works (the other tests). Root is |
| // refused as for every carlos move. |
| - c := &fakeOfflineConsole{gets: []frame{{"host": tHost, "state": "none"}}} |
| + c := &fakeOfflineConsole{gets: []frame{{"host": oHost, "state": "none"}}} |
| ts := httptest.NewServer(c) |
| defer ts.Close() |
| var out bytes.Buffer |
| deps := moveDeps{session: func(string) (*apiSession, error) { t.Error("signed in as root"); return nil, nil }, euid: func() int { return 0 }, poll: time.Millisecond} |
| - if code := moveMain(context.Background(), []string{"offline", "status", "--host", tHost, "--app", "titogo"}, &out, deps); code != 5 { |
| + if code := moveMain(context.Background(), []string{"offline", "status", "--host", oHost, "--app", "shop"}, &out, deps); code != 5 { |
| t.Fatalf("exit %d:\n%s", code, out.String()) |
| } |
| wantLines(t, out.String(), "Run carlos move as yourself, not as root. It uses your own credentials.") |
| @@ -1722,13 +1726,13 @@ func TestMoveOfflineStatusFailed(t *testing.T) { |
| say string |
| }{ |
| {"failed seal, flag only", "offline-sealing", frame{"failed": true}, |
| - "The move could not finish a step: failed. Run carlos move offline status --host acme.go.tito.io for each item."}, |
| + "The move could not finish a step: failed. Run carlos move offline status --host acme.shop.example.com for each item."}, |
| {"failed seal, sealer report", "offline-sealing", frame{"failed": true, "reports": []frame{sealerFailed}}, |
| - "The move could not finish a step: special file in the archive. Run carlos move offline status --host acme.go.tito.io for each item."}, |
| + "The move could not finish a step: special file in the archive. Run carlos move offline status --host acme.shop.example.com for each item."}, |
| {"failed landing, target report", "offline-landed", frame{"failed": true, "reports": []frame{targetFailed}}, |
| - "uk could not take acme.go.tito.io: failed. Run carlos move offline abort --host acme.go.tito.io to move it back."}, |
| + "uk could not take acme.shop.example.com: failed. Run carlos move offline abort --host acme.shop.example.com to move it back."}, |
| {"failed target before the flip", "offline-stopping", frame{"failed": true, "reports": []frame{targetFailed}}, |
| - "uk could not take acme.go.tito.io: failed. Run carlos move offline abort --host acme.go.tito.io to move it back."}, |
| + "uk could not take acme.shop.example.com: failed. Run carlos move offline abort --host acme.shop.example.com to move it back."}, |
| } { |
| t.Run(c.name, func(t *testing.T) { |
| f := &fakeOfflineConsole{gets: []frame{offView(c.state, c.extra)}} |
| @@ -1747,13 +1751,13 @@ func TestMoveOfflineStatusFailed(t *testing.T) { |
| func TestMoveOfflineStatusShowsPathsLeft(t *testing.T) { |
| c := &fakeOfflineConsole{gets: []frame{offView("offline-finishing", frame{ |
| "next": "finish", |
| - "left": []frame{{"box": "ie-box", "path": "/opt/carlos/live/acme.go.tito.io", "reason": "a root-owned directory"}}, |
| + "left": []frame{{"box": "ie-box", "path": "/opt/carlos/live/acme.shop.example.com", "reason": "a root-owned directory"}}, |
| })}} |
| code, out := runOfflineAgainst(t, c, "status") |
| if code != 0 { |
| t.Fatalf("exit %d:\n%s", code, out) |
| } |
| - wantLines(t, out, "ie-box left /opt/carlos/live/acme.go.tito.io in place: a root-owned directory.") |
| + wantLines(t, out, "ie-box left /opt/carlos/live/acme.shop.example.com in place: a root-owned directory.") |
| } |
| |
| // A failed report seen after the open is not silent: status says it and exits |
| @@ -1772,13 +1776,13 @@ func TestMoveOfflineFailedReportAfterTheOpen(t *testing.T) { |
| }{ |
| // Abort refuses once open, so a target failure there says MV-O9. |
| {"target, open", "offline-open", failedRep("uk-box", "target", "config"), |
| - "The move could not finish a step: the config check failed. Run carlos move offline status --host acme.go.tito.io for each item."}, |
| + "The move could not finish a step: the config check failed. Run carlos move offline status --host acme.shop.example.com for each item."}, |
| {"sealer, finishing", "offline-finishing", failedRep("ie-box", "sealer", "lease"), |
| - "The move could not finish a step: the lease check failed. Run carlos move offline status --host acme.go.tito.io for each item."}, |
| + "The move could not finish a step: the lease check failed. Run carlos move offline status --host acme.shop.example.com for each item."}, |
| {"source, open", "offline-open", failedRep("ie-box", "source", "warm-cache"), |
| - "ie-box could not clean up acme.go.tito.io: the warm-cache check failed. Run carlos move offline status --host acme.go.tito.io for each item."}, |
| + "ie-box could not clean up acme.shop.example.com: the warm-cache check failed. Run carlos move offline status --host acme.shop.example.com for each item."}, |
| {"source, reverting", "offline-reverting", failedRep("ie-box", "source", "warm-cache"), |
| - "ie-box could not clean up acme.go.tito.io: the warm-cache check failed. Run carlos move offline status --host acme.go.tito.io for each item."}, |
| + "ie-box could not clean up acme.shop.example.com: the warm-cache check failed. Run carlos move offline status --host acme.shop.example.com for each item."}, |
| } { |
| t.Run(c.name, func(t *testing.T) { |
| f := &fakeOfflineConsole{gets: []frame{offView(c.state, frame{"reports": []frame{c.rep}})}} |