Add optional automatic check cycle (clear queue -> scan FIPs -> wait -> repeat)
An admin-controlled scenario that repeats what the operator does by hand: clear the IP queue, scan and enqueue all free Floating IPs, wait until every queued address reaches a terminal state (so results are in the Registry), then wait a configurable interval and start over. - control-api: new auto_cycle singleton table (migration 0008) holding enabled/interval/max-run settings and persisted phase state, so the cycle survives restarts; engine in orchestrator/autocycle.go driven from the existing loop tick with an injectable "now" for deterministic tests. - Interval (default 1h, min 60s) and max wait (default unlimited, timeout outcome) are runtime settings, never hardcoded. - The periodic fip_scan_interval_seconds scan is skipped while the cycle is enabled. An emptied queue mid-cycle counts as finished; stopping during the pause keeps the last cycle's outcome. - API: GET/PUT /api/v1/admin/auto-cycle, POST .../start, POST .../stop. - admin-dashboard: "Автоматический цикл" panel on /settings and an "Автоцикл активен" indicator on /overview. - Tests for db, orchestrator, httpapi and dashboard; run-local-e2e.sh now exercises a full auto cycle; docs updated; bin/ rebuilt with refreshed SHA256SUMS. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
008ae1b0db
commit
cd37b10f3b
35 files changed
+2205
-16
No files matched your search
@@ -58,6 +58,18 @@ It will:
|
||||
5. Poll `GET /api/v1/admin/status` until every configured IP has reached a
|
||||
terminal state (`done` or `failed`).
|
||||
6. Print the final `/api/v1/admin/status` and `/api/v1/admin/ips` output.
|
||||
7. Force a re-check of the finished address via `POST /api/v1/admin/ips`
|
||||
and wait for it to drain (`attempt_number` advances).
|
||||
8. Exercise the **automatic cycle** (`/api/v1/admin/auto-cycle`): set the
|
||||
smallest allowed interval (60s) and a 120s run limit, `start` it, and
|
||||
wait for the first cycle to finish. The script then asserts that the
|
||||
outcome is `completed`, the phase is `waiting` with `runs_total=1`, and
|
||||
that the registry's `total_cycles` for `127.0.0.1` grew (the cycle
|
||||
cleared the queue, re-scanned the mock floating IP and re-checked it).
|
||||
Finally it `stop`s the cycle and asserts it is `idle`. The second cycle
|
||||
(the interval wait) is covered by unit tests, so the script does not
|
||||
sit through the 60s pause. The script exits non-zero if any assertion
|
||||
fails.
|
||||
|
||||
Expect to see `127.0.0.1` end with `"state":"done"` and
|
||||
`"overall_result":"pass"` (all egress checks against the stub targets
|
||||
|
||||
Reference in new issue
Block a user