test(camera): isolate and validate toggle acceptance
Heimdall Gitea / Detect CI scope (pull_request) Canceled after 0s
Heimdall Gitea / CI policy (pull_request) Canceled after 0s
Heimdall Gitea / Build and tests (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan server image (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan agent image (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Canceled after 0s
Heimdall Gitea / Publish versioned installer release (pull_request) Canceled after 0s
Heimdall Gitea / Detect CI scope (pull_request) Canceled after 0s
Heimdall Gitea / CI policy (pull_request) Canceled after 0s
Heimdall Gitea / Build and tests (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan server image (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan agent image (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Canceled after 0s
Heimdall Gitea / Publish versioned installer release (pull_request) Canceled after 0s
This commit is contained in:
1 parent
1a34e2f2ac
commit
6e68045f1e
2 files changed
+18
-5
No files matched your search
@@ -49,7 +49,7 @@ This acceptance proves the source-built Central/Agent software lifecycle with a
|
||||
- Do not count `docker top` output when the runtime's `top` implementation differs. Prefer an in-container process identity check (`/proc/*/comm` equals `ffmpeg`) and ensure the inspection process cannot match itself. A shell command line containing the text `ffmpeg` creates a false positive if the check scans all command lines.
|
||||
- Before asserting lifecycle timing, first confirm Agent `Online`, persisted camera assignment, effective config enabled value and version, and `LastAppliedCameraConfigVersion` acknowledgement. A failed precondition is not an OFF/ON timing result.
|
||||
- On failed acceptance, collect sanitized Central, Agent, RTSP server and publisher diagnostics before the cleanup trap runs. Then verify project resource counts and exact image tags as described above.
|
||||
- Current disposable attempts proved bootstrap, registration, assignment and Disabled config acknowledgement, but have not yet proved toggle timing or restart persistence. Treat #59/#199 as open until a corrected process measurement completes the whole cycle.
|
||||
- Earlier disposable attempts proved bootstrap, registration, assignment and Disabled config acknowledgement, but did not prove toggle timing or restart persistence. The completed source-built run below supersedes those incomplete attempts; physical camera and deployed-host validation remain external.
|
||||
|
||||
## Latest source-built run
|
||||
|
||||
@@ -65,7 +65,7 @@ The sixth historical run kept the FFmpeg process deadline separate from the conf
|
||||
|
||||
## Source-built acceptance — 2026-11-12
|
||||
|
||||
`acceptance.sh` passed with project `heimdall-157-1794486043-22368`, Central tag `heimdall:heimdall-157-1794486043-22368-central`, and Agent tag `heimdall-agent:heimdall-157-1794486043-22368-agent`. It exercised three ON/OFF cycles with FFmpeg release at 1,232ms, 309ms, and 359ms, then a final OFF at 1,134ms before restart. Each transition verified the exact Central config digest ACK and the expected `camera.<id>.enabled` value. The process monitor rejected counts above one. Agent restart while ON preserved its identity and resumed capture; Agent and Central restart while OFF preserved Disabled and produced no FFmpeg process. Cleanup verified zero project containers, volumes, and networks and absence of both exact local image tags. This is synthetic source-built software evidence, not camera hardware or deployed-host timing.
|
||||
`acceptance.sh` passed with project `heimdall-157-1794487097-5472`, Central tag `heimdall:heimdall-157-1794487097-5472-central`, and Agent tag `heimdall-agent:heimdall-157-1794487097-5472-agent`. Central and PostgreSQL published only on `127.0.0.1`. After confirming the ON config digest ACK, it exercised three ON/OFF cycles with FFmpeg release at 1,153ms, 309ms, and 333ms, then a final OFF at 907ms before restart. Each transition verified the exact Central config digest ACK and expected `camera.<id>.enabled` value. The process monitor rejected counts above one. Agent restart while ON preserved its identity and resumed capture; Agent and Central restart while OFF preserved Disabled and produced no FFmpeg process. Cleanup verified zero project containers, volumes, and networks and absence of both exact local image tags. This is synthetic source-built software evidence, not camera hardware or deployed-host timing.
|
||||
|
||||
## Camera status contract acceptance
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ env_next="$temp_dir/acceptance.env.next"
|
||||
compose_override="$temp_dir/compose.override.yml"
|
||||
config_headers="$temp_dir/config.headers"
|
||||
config_body="$temp_dir/config.json"
|
||||
stage=setup
|
||||
local_image_tags=("heimdall:${project}-central" "heimdall-agent:${project}-agent")
|
||||
compose_files=(-f "$root/docker/docker-compose.yml" -f "$compose_override")
|
||||
cleanup() {
|
||||
@@ -18,7 +19,8 @@ cleanup() {
|
||||
trap - EXIT
|
||||
cleanup_failed=0
|
||||
if (( status != 0 )); then
|
||||
docker compose -p "$project" --env-file "$env_file" "${compose_files[@]}" logs --no-color --tail 250 heimdall-agent 2>/dev/null |
|
||||
printf 'acceptance failed at stage=%s\n' "$stage" >&2
|
||||
docker compose -p "$project" --env-file "$env_file" "${compose_files[@]}" logs --timestamps --no-color --tail 250 heimdall-agent 2>/dev/null |
|
||||
grep -E 'Config update received: config\.invalidated|Full configuration fetched successfully|Stream stopped for camera|camera config ACK' | tail -40 || true
|
||||
fi
|
||||
docker compose -p "$project" --env-file "$env_file" "${compose_files[@]}" down --volumes --remove-orphans >/dev/null 2>&1 || cleanup_failed=1
|
||||
@@ -50,13 +52,13 @@ cat >"$env_file" <<EOF
|
||||
POSTGRES_DB=heimdall_acceptance
|
||||
POSTGRES_USER=acceptance
|
||||
POSTGRES_PASSWORD=$db_password
|
||||
POSTGRES_PORT=$pg_port
|
||||
POSTGRES_PORT=127.0.0.1:$pg_port
|
||||
DATABASE_URL=Host=postgresql;Port=5432;Database=heimdall_acceptance;Username=acceptance;Password=$db_password
|
||||
JWT__KEY=$jwt_key
|
||||
JWT__REFRESHKEY=$jwt_refresh
|
||||
JWT__ISSUER=heimdall-acceptance
|
||||
JWT__AUDIENCE=heimdall-acceptance-api
|
||||
WEB_PORT=$port
|
||||
WEB_PORT=127.0.0.1:$port
|
||||
ACCEPTANCE_PROJECT=$project
|
||||
DOCKER_GID=0
|
||||
HEIMDALL_NETWORK_NAME=${project}-network
|
||||
@@ -149,9 +151,12 @@ wait_ack() {
|
||||
}
|
||||
|
||||
printf 'project=%s central_tag=%s agent_tag=%s\n' "$project" "${local_image_tags[0]}" "${local_image_tags[1]}"
|
||||
stage=build
|
||||
compose build heimdall heimdall-agent
|
||||
stage=central-startup
|
||||
compose up -d postgresql heimdall
|
||||
wait_http
|
||||
stage=bootstrap
|
||||
admin_password="Tst!$(openssl rand -hex 20)A9"
|
||||
bootstrap=$(curl -fsS --max-time 10 -H 'Content-Type: application/json' -d "{\"email\":\"admin-${stamp}@heimdall.test\",\"password\":\"$admin_password\",\"displayName\":\"Acceptance Admin\"}" "$api/api/auth/bootstrap-admin")
|
||||
admin_token=$(jq -er '.accessToken' <<<"$bootstrap")
|
||||
@@ -167,6 +172,7 @@ camera=$(request -X POST -d "{\"siteId\":\"$site_id\",\"name\":\"Synthetic camer
|
||||
camera_id=$(jq -er '.id' <<<"$camera")
|
||||
[[ $(jq -r '.status' <<<"$camera") == Disabled ]]
|
||||
printf 'synthetic camera created\n'
|
||||
stage=agent-startup
|
||||
compose up -d synthetic-camera synthetic-camera-publisher heimdall-agent
|
||||
agent_id=
|
||||
for _ in $(seq 1 60); do
|
||||
@@ -178,8 +184,10 @@ done
|
||||
[[ -n "$agent_id" ]]
|
||||
printf 'Agent registered\n'
|
||||
request -X POST -d "{\"cameraId\":\"$camera_id\",\"agentId\":\"$agent_id\",\"reason\":\"synthetic acceptance\"}" "$api/api/assignments" >/dev/null
|
||||
stage=initial-on
|
||||
request -X POST "$api/api/cameras/$camera_id/toggle-status" >/dev/null
|
||||
wait_count 1 10
|
||||
wait_ack true
|
||||
|
||||
off_once() {
|
||||
started=$(date +%s%N)
|
||||
@@ -199,19 +207,23 @@ off_once() {
|
||||
wait_ack false
|
||||
}
|
||||
for iteration in 1 2 3; do
|
||||
stage="cycle-${iteration}-off"
|
||||
off_once
|
||||
stage="cycle-${iteration}-on"
|
||||
request -X POST "$api/api/cameras/$camera_id/toggle-status" >/dev/null
|
||||
wait_count 1 10
|
||||
wait_ack true
|
||||
count=$(ffmpeg_count)
|
||||
[[ "$count" == 1 ]]
|
||||
done
|
||||
stage=agent-restart-on
|
||||
compose restart heimdall-agent
|
||||
wait_count 1 10
|
||||
agents=$(request "$api/api/agents/by-site/$site_id?page=1&pageSize=20")
|
||||
old_agent_id=$(jq -er '[.items[]? | select(.name=="camera-157-agent")][0].id' <<<"$agents")
|
||||
[[ "$old_agent_id" == "$agent_id" ]]
|
||||
wait_ack true
|
||||
stage=final-off
|
||||
off_once
|
||||
agents=$(request "$api/api/agents/by-site/$site_id?page=1&pageSize=20")
|
||||
old_agent_id=$(jq -er '[.items[]? | select(.name=="camera-157-agent")][0].id' <<<"$agents")
|
||||
@@ -220,6 +232,7 @@ wait_count 0 10
|
||||
agents=$(request "$api/api/agents/by-site/$site_id?page=1&pageSize=20")
|
||||
new_agent_id=$(jq -er '[.items[]? | select(.name=="camera-157-agent")][0].id' <<<"$agents")
|
||||
[[ "$old_agent_id" == "$new_agent_id" && "$new_agent_id" == "$agent_id" ]]
|
||||
stage=central-restart-off
|
||||
compose restart heimdall
|
||||
wait_http
|
||||
sleep 2
|
||||
|
||||
Reference in new issue
Block a user