Stop polling idle agent update controls
CI / Test (rest) (pull_request) Successful in 22s
CI / Lint (pull_request) Successful in 11s
CI / Build (windows/amd64) (pull_request) Successful in 8s
CI / Test (store) (pull_request) Successful in 40s
CI / Build (linux/amd64) (pull_request) Successful in 7s
CI / Build (linux/arm64) (pull_request) Successful in 8s
CI / Test (server-http) (pull_request) Successful in 1m45s
e2e / Playwright vs docker-compose (pull_request) Successful in 1m26s
CI / Test (rest) (pull_request) Successful in 22s
CI / Lint (pull_request) Successful in 11s
CI / Build (windows/amd64) (pull_request) Successful in 8s
CI / Test (store) (pull_request) Successful in 40s
CI / Build (linux/amd64) (pull_request) Successful in 7s
CI / Build (linux/arm64) (pull_request) Successful in 8s
CI / Test (server-http) (pull_request) Successful in 1m45s
e2e / Playwright vs docker-compose (pull_request) Successful in 1m26s
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
"gitea.dcglab.co.uk/steve/restic-manager/internal/version"
|
||||
)
|
||||
|
||||
func TestFleetUpdatePagePreservesFiltersWithoutTypedConfirmation(t *testing.T) {
|
||||
func TestFleetUpdateIdlePageDoesNotPollOrRequireTypedConfirmation(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, baseURL, st := newTestServerWithUI(t)
|
||||
cookie := loginAsAdmin(t, st)
|
||||
@@ -44,9 +44,6 @@ func TestFleetUpdatePagePreservesFiltersWithoutTypedConfirmation(t *testing.T) {
|
||||
`id="fleet-filter-name"`,
|
||||
`id="fleet-filter-version"`,
|
||||
`id="fleet-filter-state"`,
|
||||
"htmx:beforeSwap",
|
||||
"fleetCaptureUIState()",
|
||||
"fleetRestoreUIState()",
|
||||
"r.style.display=",
|
||||
} {
|
||||
if !strings.Contains(body, want) {
|
||||
@@ -56,6 +53,33 @@ func TestFleetUpdatePagePreservesFiltersWithoutTypedConfirmation(t *testing.T) {
|
||||
if strings.Contains(body, "Type selected count to confirm") || strings.Contains(body, `id="fleet-update-confirm"`) {
|
||||
t.Error("page still renders the typed-count confirmation")
|
||||
}
|
||||
if strings.Contains(body, `hx-trigger="every 3s`) {
|
||||
t.Error("idle selection page must not poll and replace operator input")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFleetUpdateRunningPagePollsForProgress(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, baseURL, st := newTestServerWithUI(t)
|
||||
cookie, userID := loginAsAdminWithID(t, st)
|
||||
hostID := makeHost(t, st, "fleet-running-host")
|
||||
if err := st.CreateFleetUpdate(context.Background(), store.FleetUpdate{
|
||||
ID: ulid.Make().String(), StartedByUserID: userID, TargetVersion: version.Version,
|
||||
}, []string{hostID}); err != nil {
|
||||
t.Fatalf("create fleet update: %v", err)
|
||||
}
|
||||
|
||||
req, _ := stdhttp.NewRequest("GET", baseURL+"/settings/fleet-update", nil)
|
||||
req.AddCookie(cookie)
|
||||
res, err := stdhttp.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("get fleet update page: %v", err)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
raw, _ := io.ReadAll(res.Body)
|
||||
if body := string(raw); !strings.Contains(body, `hx-trigger="every 3s`) {
|
||||
t.Error("running rollout page must poll for progress")
|
||||
}
|
||||
}
|
||||
|
||||
// fakeFleetWorker stands in for *fleetupdate.Worker in HTTP tests.
|
||||
|
||||
Reference in New Issue
Block a user