Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/dev/file-budget.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ lib/pithead/49-control-request-loop.sh 402
scripts/build-pithead-selftest.sh 416
scripts/watch/scheduled-run-watch.sh 416
scripts/watch/trivyignore-watch.sh 599
tests/integration/e2e.sh 684
tests/integration/e2e.sh 658
tests/integration/fakes/test_contract.py 437
tests/integration/lib.sh 686
tests/integration/lib/live-upgrade-support.sh 413
Expand All @@ -71,7 +71,7 @@ tests/integration/selftest/selftest-rigforge-writable-keys.sh 402
tests/integration/selftest/selftest-zmq-probe.sh 431
tests/integration/selftest/selftest.sh 685
tests/os/appliance-approval-verdict.sh 449
tests/os/appliance-node-runtime-leg.sh 448
tests/os/appliance-node-runtime-leg.sh 438
tests/os/failure-evidence.sh 567
tests/os/phases/install-restore.sh 414
tests/os/phases/rig.sh 448
Expand Down
10 changes: 10 additions & 0 deletions docs/dev/integration-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,16 @@ via an `EXIT` trap):
`/opt/rigforge/data/e2e-backups/` (created mode 700, owned by the SSH login user — never inside
the RigForge worker build directory, which a worker upgrade archives away) and repoints it at the
bench so the matrix has a real worker mining through this stack (1 worker → run with `--workers 1`).
A pool the harness inserts carries `rig-id` `pithead-e2e`. A rig whose config already names the
bench keeps that pool and its own `rig-id` unchanged, so the dashboard and the rig-control phase
still find the rig under its own name. The reload restarts the rig's `xmrig` unit (a
root-run unit may only be allowed `stop` then `start`) and fails unless the unit's MainPID changed;
there is no signal fallback, since a signal proves no reload. Every worker gate
after a borrow or re-arm waits for an online worker named after the bench pool's `rig-id`, or its
stratum `user` when that is empty (the name xmrig-proxy lists it under), so another worker on the
proxy cannot satisfy it. The gate's log lines never print that name, because a stratum `user` can
be a payout address. A bench pool with neither, or a name outside `[A-Za-z0-9._:@+-]`, falls back
to counting proxy workers, with a warning ([#3972](https://github.com/p2pool-starter-stack/pithead/issues/3972)).
With `--no-miner` nothing is borrowed, and the harness runs with `--no-mining-asserts`: the
workers-online and stratum-hashes assertions skip with a logged notice while every other
assertion stays binding ([#905](https://github.com/p2pool-starter-stack/pithead/issues/905)).
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/testing-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ the failure means.
| Post-provision control on the appliance (#1966): a benign energy edit applies; a disruptive operational edit is refused without typed `APPLY`, applies with it, and is restored. Doctor returns all `{status,message}` rows, including a failed result carrying the complete document when its own exit is nonzero with monerod deliberately stopped. A p2pool tail is clamped to 200 lines/65,536 bytes, records an applied result when the byte cap closes its pipe, and redacts the known payout address; wallet-rpc logs remain refused | `tests/os/appliance-diagnostics-leg.sh` + battery `--phase provision` | 1 ✅ (verdict failure controls plus control/diagnostics route and host-runner suites) · 4 (added — unverified until the combined battery) |
| Dashboard backup recovery (#1965/#1966): the control request survives its own dashboard restart, returns a downloadable encrypted archive plus one-time passphrase, and leaves the stack and dashboard serving; the install phase restores a real archive to a fresh disk and checks the running payout wallet plus Tor onion identity | battery `--phase provision` + `--phase install` restore leg | Candidate tier-1 evidence only; tier 4 added and unverified until the combined battery |
| RC2 hostname identity (#1957/#1966/#2223): the wizard names the appliance `fixture-box`; kernel hostname, rendered `HOST_IP`, `/api/state`'s header source, served certificate DNS+LAN-IP SANs and mDNS resolution through active Avahi must agree initially. A day-two `fixture-next` preview is pure and approval-gated; a commit without its envelope is refused, while the ordinary authenticated control route applies the host-generated preview. The new identity must survive an unaided reboot and the A/B migration update | `tests/os/appliance-hostname-leg.sh`, `tests/os/appliance-config-approval-leg.sh` + battery `--phase provision` | 1 ✅ (pure identity/prompt/consumer verdict controls) · 4 (written — unverified until the combined image battery runs) |
| RC2 sensitive-commit/node rows (#1959/#1898/#1943/#1946, retargeted by #2076): the first live config read is followed by an authenticated read of the shipped `configversion.mjs`, requiring a non-empty module with `Saving is blocked` and `_config_version_newer` but no `Config file version` (#3239); unreadable assets fail as unexercised. A sensitive day-two commit is refused without the typed confirmation envelope and leaves live identity unchanged; a confirmed one applies, audits against the signed-in actor with **no** `approver` field, and converges hostname/mDNS/certificate identity; a dashboard-password repoint commits behind typed `APPLY` and the envelope, its verdict read from the host result spool (the dashboard poll carries the login it replaces), the new login reads `/api/config`, and the fixture password is restored the same way (#2367). A snapshot taken before the first password commit is restored host-side after every exit, including lost verdicts and failed restoration previews; cleanup waits for the control spool to drain, preserves the failed assertion, and verifies authenticated `/api/config` with the original login (#2986). A standalone local Monero node username edit, then a password edit, each previews as a `CONFIRM` change, applies with typed `APPLY`, and must leave monerod's and the dashboard's container environment and p2pool's `--rpc-login` argument carrying the new login (checked against podman's inspect output, where names carry no Docker-style leading slash). The fixture sets `p2pool.clearnet` host-side first (#165). The dashboard can also commit it, behind the approval envelope, but this leg keeps its proposal to `monero.*` and `tari.*`. Reserved reachable Monero/Tari endpoints must pass the host preflight, land in rendered runtime state and the current p2pool container's narrowly extracted arguments (including each nonblank proposed login part in its live `--rpc-login`, compared without printing it), and make an endpoint-bound current-startup `uses chain_id` consumer probe pass before the original local-node config is restored; the restore also runs when the leg fails early. The guest-side fake Telegram transport is gone with the approval round-trip, so this leg now drives the ordinary authenticated control route | `tests/os/appliance-config-approval-leg.sh`, `tests/os/appliance-node-runtime-leg.sh` plus the existing `tests/integration/lib/mergemine-probe.sh` verdict | 1 ✅ (host policy suite in `tests/stack/test-confirm-approval.sh`; pure round-trip controls) · 4 (written — requires reserved node inputs and remains unverified until the combined battery) |
| RC2 sensitive-commit/node rows (#1959/#1898/#1943/#1946, retargeted by #2076): the first live config read is followed by an authenticated read of the shipped `configversion.mjs`, requiring a non-empty module with `Saving is blocked` and `_config_version_newer` but no `Config file version` (#3239); unreadable assets fail as unexercised. A sensitive day-two commit is refused without the typed confirmation envelope and leaves live identity unchanged; a confirmed one applies, audits against the signed-in actor with **no** `approver` field, and converges hostname/mDNS/certificate identity; a dashboard-password repoint commits behind typed `APPLY` and the envelope, its verdict read from the host result spool (the dashboard poll carries the login it replaces), the new login reads `/api/config`, and the fixture password is restored the same way (#2367). A snapshot taken before the first password commit is restored host-side after every exit, including lost verdicts and failed restoration previews; cleanup waits for the control spool to drain, preserves the failed assertion, and verifies authenticated `/api/config` with the original login (#2986). A standalone local Monero node username edit, then a password edit, each previews as a `CONFIRM` change, applies with typed `APPLY`, and must leave monerod's and the dashboard's container environment and p2pool's `--rpc-login` argument carrying the new login (checked against podman's inspect output, where names carry no Docker-style leading slash). The fixture sets `p2pool.clearnet` host-side first (#165): it waits for an idle control runner and a free mutation lock, retries a failed apply once, and a second failure reports the apply's exit status and an output tail passed through the appliance redactor (`tests/os/lib/redact-addr.sh`), then clipped (#3980). The dashboard can also commit it, behind the approval envelope, but this leg keeps its proposal to `monero.*` and `tari.*`. Reserved reachable Monero/Tari endpoints must pass the host preflight, land in rendered runtime state and the current p2pool container's narrowly extracted arguments (including each nonblank proposed login part in its live `--rpc-login`, compared without printing it), and make an endpoint-bound current-startup `uses chain_id` consumer probe pass before the original local-node config is restored; the restore also runs when the leg fails early. The guest-side fake Telegram transport is gone with the approval round-trip, so this leg now drives the ordinary authenticated control route | `tests/os/appliance-config-approval-leg.sh`, `tests/os/appliance-node-runtime-leg.sh` plus the existing `tests/integration/lib/mergemine-probe.sh` verdict | 1 ✅ (host policy suite in `tests/stack/test-confirm-approval.sh`; pure round-trip controls) · 4 (written — requires reserved node inputs and remains unverified until the combined battery) |
| Failing appliance rows carry their evidence, not just a verdict (#2060): the hostname rows preserve empty snapshot columns, fail an unavailable dashboard state as `state=empty`, and print kernel/static hostname, rendered host, dashboard state, certificate, Avahi, mDNS, card addresses and named HTTP status want-beside-got plus what Avahi published and on which interface (the address moved between runs, the interface is the discriminator); the control-runner rows print the runner result and value read back, reporting runner completion as unknown when the requested value has already landed but no result was written; the doctor row stays total over a FLATTENED `checks`, the shape it is named after; the bundle rows print the tail of the build log, with a missing log, an empty log and a failed build each getting their own sentence | `tests/os/appliance-hostname-leg.sh`, `appliance-diagnostics-leg.sh`, `provision-browser-submit.sh` and `appliance-approval-verdict.sh` `--self-test`, plus `tests/os/selftest-row-payloads.sh` and `tests/os/bundle-build-evidence.sh --self-test` | 1 ✅ (each payload driven against the shapes the verdict refuses, and a mutation of each field reddens its own control) · 4 (the rows themselves stay red until the defects behind them are fixed — this is the evidence step the issue asks for first) |
| The appliance's mDNS name resolves to a LAN address, never a container bridge (#2060): `appliance_mdns_interfaces` names every interface holding a global v4 address that is NOT a kernel bridge, and `appliance_reconcile_mdns_interfaces` writes that list as Avahi's `allow-interfaces` through the same `/etc` overlay the console login uses, reporting a change ONLY when the file actually moved so the caller restarts Avahi exactly when there is something new to announce. A positive list rather than a deny-list because the boot render reconciles identity BEFORE `up` creates either bridge, where a deny-list would come out empty. The rewrite also runs independently of the hostname label: an appliance left on the default `auto` name had no label to reconcile and returned before Avahi was ever touched | `tests/stack/appliance/test-appliance-hostname.sh` (canned `ip` output from the measured guest; a config carrying no `allow-interfaces` line must report no change, the control that catches a silent no-op rewrite), `tests/os/verify-image.sh` (the shipped config carries the line the rewrite keys on) · battery `--phase provision` | 1 ✅ · 4 (unverified until the next battery run; the mechanism itself is measured — an `avahi-daemon` + `libnss-mdns` container with one NIC and one kernel bridge resolves its own name to the bridge without the line and to the NIC with it) |
| The control POST outlasts the dashboard's own answer window (#2060/#2223): `handle_control_*` holds the request open until the runner answers or `CONTROL_WAIT_S` elapses and only THEN returns 202 with the id `dashboard_control_request`'s polling loop needs. The two clients recover on deliberately different terms. The KVM harness helper polls the caller-supplied id whenever a 2xx POST response is empty OR malformed, and also on a synthetic `000` or a proxy 5xx after the request was accepted, refusing received 1xx–4xx. Preview POSTs without a usable returned id may be re-submitted at most three times after transport loss, HTTP 000 or an unstructured proxy 5xx, with each retry capped to the remaining caller deadline: they only stage intents, and only a returned, validated preview is later committed. A complete 2xx preview with a canonical server id remains usable after a trailing curl error. A connection failure before any HTTP response (curl 7 with HTTP 000 and an empty body) may reconnect for any verb, including commit, with at most three total connection attempts under the original deadline. No request reached the listener on those failed connections. Exhausted connection failures fail without polling the unchanged preview. Other commit transport failures, empty responses and proxy 5xx responses remain ambiguous and are polled without re-submitting the mutation; received refusals remain terminal. The browser client is narrower: `controlCommitResult`, shared by Configuration and Worker adoption, polls the preview id it already holds ONLY when a successful body is exactly empty, and treats a truncated body — one that parses but carries no result status — as terminal, because a half-read answer is a different failure from a lost one and must not be retried into a false success. Thus an 8s `-m` on the POST or a dropped response would otherwise discard every control operation that did real work — a commit that runs an apply, doctor on an unhealthy box — while their fast siblings answered inside it and passed, which is what made the reds read as the runner losing results. The check reads both numbers from their own sources, so neither side can move alone | `dashboard/tests/frontend/config/configview.test.mjs`, `workers/workeradopt.test.mjs`; `tests/os/appliance-config-approval-leg.sh --self-test`, `tests/os/selftest-control-admission.sh` | 1 ✅ (the cap mutated back under the server's window reddens the check; the admission regression fails without reconnecting an undelivered commit and pins single delivery after ambiguous responses) · 4 (unverified until the combined battery runs) |
Expand Down
25 changes: 1 addition & 24 deletions tests/integration/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -346,29 +346,6 @@ wait_synced() { # <timeout_s>
done
}

# Nudge the miner's xmrig to reload its (rewritten) config. xmrig watches its config file and
# reloads on change; the systemctl/SIGHUP fallbacks cover builds that don't. At least one must work;
# forward paths then poll the test bench for the worker, so the exact mechanism doesn't matter.
miner_reload() {
on_miner "sudo -n systemctl restart xmrig >/dev/null 2>&1 || systemctl --user restart xmrig >/dev/null 2>&1 || pkill -HUP -x xmrig >/dev/null 2>&1"
}

# Poll the test bench's dashboard for at least <n> workers connected.
wait_workers() { # <n> <timeout_s>
local want="$1" deadline=$(($(date +%s) + ${2:-180})) got
while :; do
got="$(on_bench "curl -fsS --max-time 8 http://127.0.0.1:8000/api/state 2>/dev/null | jq -r '.proxy_workers // 0' 2>/dev/null" || echo 0)"
[ -n "$got" ] && [ "$got" -ge "$want" ] 2>/dev/null && {
ok "$got worker(s) mining through the test bench"
return 0
}
[ "$(date +%s)" -ge "$deadline" ] && {
warn "only $got worker(s) connected after $((${2:-180}))s (wanted $want)"
return 1
}
sleep 8
done
}
# --- Phase 0: preflight -----------------------------------------------------
preflight() {
log "Preflight"
Expand Down Expand Up @@ -575,7 +552,7 @@ borrow_miner() {
on_miner "cp -a '$MINER_XMRIG_CONFIG' '$MINER_CFG_BACKUP'" || die "Failed to back up the miner config."
step "miner config backed up → $MINER_CFG_BACKUP"
repoint_miner || die "Failed to repoint the miner config."
wait_workers "$WORKERS" 180 || warn "proceeding, but the matrix's mining assertions may not pass with too few workers"
wait_workers "$WORKERS" 180 "$MINER_WORKER_NAME" || warn "proceeding, but the matrix's mining assertions may not pass without the borrowed rig"
}

# --- Phase 4: deploy the branch ---------------------------------------------
Expand Down
Loading
Loading