hub 0.177.0: Reboot guest on the host page (D65 = A, reboot_guest in the agent's closed list, 30-minute expiry); R-1346: the slow-request line and the vouch save's per-leg timing
gates / gates (push) Successful in 1m52s
gates / gates (push) Successful in 1m52s
This commit is contained in:
1 parent
dd3e4137ee
commit
636022dc31
10 files changed
+223
-16
No files matched your search
@@ -84,7 +84,8 @@ func TestHostPage_RestartAndClearHoldPosts(t *testing.T) {
|
||||
{"action": {"clear_hold"}, "arg": {"vikunja"}}, // not held
|
||||
{"action": {"restart_controller"}, "arg": {"9202"}}, // not a guest of this host
|
||||
{"action": {"restart_controller"}, "arg": {"abc"}},
|
||||
{"action": {"reboot_guest"}, "arg": {"9201"}},
|
||||
{"action": {"reboot_host"}, "arg": {"9201"}},
|
||||
{"action": {"reboot_guest"}, "arg": {"9202"}}, // not a guest of this host
|
||||
} {
|
||||
if rr := postOperatorAction(t, s, "h1", f); rr.Code != http.StatusBadRequest {
|
||||
t.Errorf("%v: status %d, want 400", f, rr.Code)
|
||||
@@ -122,3 +123,40 @@ func TestOperatorActor_NamesTheAccessToken(t *testing.T) {
|
||||
t.Fatalf("actor = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
// D65 = A: „Reboot guest" beside „Restart controller", behind a confirm step that says the apps stop for about a minute;
|
||||
// the press stores a row for THIS host's agent only. RED-PROOF: seen failing before the button and the route existed.
|
||||
func TestHostPage_RebootGuestRendersAndPosts(t *testing.T) {
|
||||
s, st := heldFixture(t)
|
||||
body := renderHost(t, s, "h1")
|
||||
for _, want := range []string{`data-reboot-guest="9201"`, `name="action" value="reboot_guest"`,
|
||||
"Reboot guest 9201 on h1 (c1)?", "every app of the household stops for about a minute"} {
|
||||
if !strings.Contains(body, want) {
|
||||
t.Errorf("host page lacks %q", want)
|
||||
}
|
||||
}
|
||||
if rr := postOperatorAction(t, s, "h1", url.Values{"action": {"reboot_guest"}, "arg": {"9201"}}); rr.Code != http.StatusSeeOther {
|
||||
t.Fatalf("reboot: %d %s", rr.Code, rr.Body.String())
|
||||
}
|
||||
if a, _ := st.PendingHostOperatorActions("h1"); len(a) != 1 || a[0].Action != "reboot_guest" || a[0].Arg != "9201" {
|
||||
t.Fatalf("the agent's reply would list %+v", a)
|
||||
}
|
||||
if c, _ := st.PendingOperatorActions("c1"); len(c) != 0 {
|
||||
t.Fatalf("the reboot reached the controller's ACK: %+v", c)
|
||||
}
|
||||
}
|
||||
|
||||
// A host with no customer has no buttons (no controller, no household) — the other branch of the template gate.
|
||||
func TestHostPage_NoRebootWithoutACustomer(t *testing.T) {
|
||||
s, st := newTestServer(t)
|
||||
if err := st.UpsertHost(&store.Host{HostID: "h9", APIKey: "k"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
now := time.Now()
|
||||
if err := st.UpsertGuestFromReport(&store.Guest{GuestID: "h9-9201", HostID: "h9", VMID: 9201, Status: "running", LastSeenAt: &now}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if body := renderHost(t, s, "h9"); strings.Contains(body, "data-reboot-guest") {
|
||||
t.Fatal("a host with no customer shows Reboot guest")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user