test(camera): verify fresh agent ack after restart
Heimdall Gitea / Detect CI scope (pull_request) Successful in 6s
Heimdall Gitea / Build and tests (pull_request) Successful in 6m24s
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Publish versioned installer release (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Canceled after 7m27s
Heimdall Gitea / Build and scan agent image (pull_request) Canceled after 7m39s
Heimdall Gitea / CI policy (pull_request) Failing after 2s
Heimdall Gitea / Detect CI scope (pull_request) Successful in 6s
Heimdall Gitea / Build and tests (pull_request) Successful in 6m24s
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Publish versioned installer release (pull_request) Canceled after 0s
Heimdall Gitea / Build and scan NVIDIA Agent image (pull_request) Canceled after 7m27s
Heimdall Gitea / Build and scan agent image (pull_request) Canceled after 7m39s
Heimdall Gitea / CI policy (pull_request) Failing after 2s
This commit is contained in:
1 parent
6e68045f1e
commit
aedc1900db
2 files changed
+30
-5
No files matched your search
@@ -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-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.
|
||||
`acceptance.sh` passed with project `heimdall-157-1794487528-14373`, Central tag `heimdall:heimdall-157-1794487528-14373-central`, and Agent tag `heimdall-agent:heimdall-157-1794487528-14373-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,242ms, 310ms, and 328ms, then a final OFF at 1,076ms before restart. Each transition verified the exact Central config digest ACK and expected `camera.<id>.enabled` value. The process monitor rejected counts above one. After Agent restart while OFF, the same Agent reported Online with a heartbeat and config ACK timestamp newer than the restart; after Central restart it again reported Online with a fresh ACK for the persisted Disabled digest. Agent restart while ON preserved its identity and resumed capture. 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
|
||||
|
||||
|
||||
@@ -144,11 +144,35 @@ wait_ack() {
|
||||
actual_enabled=$(jq -r --arg key "camera.$camera_id.enabled" '.[$key] // empty' "$config_body")
|
||||
agents=$(request "$api/api/agents/by-site/$site_id?page=1&pageSize=20")
|
||||
applied=$(jq -r "[.items[]? | select(.id==\"$agent_id\")][0].lastAppliedCameraConfigVersion // empty" <<<"$agents")
|
||||
[[ -n "$wanted" && "$wanted" == "$applied" && "$actual_enabled" == "$expected_enabled" ]] && return 0
|
||||
if [[ -n "$wanted" && "$wanted" == "$applied" && "$actual_enabled" == "$expected_enabled" ]]; then
|
||||
acknowledged_version=$wanted
|
||||
return 0
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
return 1
|
||||
}
|
||||
wait_agent_reconnected_and_ack() {
|
||||
restarted_at_ns=$1
|
||||
expected_version=$2
|
||||
for _ in $(seq 1 60); do
|
||||
agents=$(request "$api/api/agents/by-site/$site_id?page=1&pageSize=20")
|
||||
agent=$(jq -cer "[.items[]? | select(.id==\"$agent_id\")][0]" <<<"$agents")
|
||||
status=$(jq -r '.status // empty' <<<"$agent")
|
||||
heartbeat=$(jq -r '.lastHeartbeat // empty' <<<"$agent")
|
||||
applied_version=$(jq -r '.lastAppliedCameraConfigVersion // empty' <<<"$agent")
|
||||
applied_at=$(jq -r '.lastAppliedCameraConfigAt // empty' <<<"$agent")
|
||||
if [[ "$status" == Online && -n "$heartbeat" && -n "$applied_at" && "$applied_version" == "$expected_version" ]]; then
|
||||
heartbeat_ns=$(date -u -d "$heartbeat" +%s%N)
|
||||
applied_at_ns=$(date -u -d "$applied_at" +%s%N)
|
||||
if (( heartbeat_ns > restarted_at_ns && applied_at_ns > restarted_at_ns )); then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
printf 'project=%s central_tag=%s agent_tag=%s\n' "$project" "${local_image_tags[0]}" "${local_image_tags[1]}"
|
||||
stage=build
|
||||
@@ -227,12 +251,12 @@ 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")
|
||||
post_off_restart_started_ns=$(date +%s%N)
|
||||
compose restart heimdall-agent
|
||||
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" ]]
|
||||
wait_agent_reconnected_and_ack "$post_off_restart_started_ns" "$acknowledged_version"
|
||||
stage=central-restart-off
|
||||
central_restart_started_ns=$(date +%s%N)
|
||||
compose restart heimdall
|
||||
wait_http
|
||||
sleep 2
|
||||
@@ -240,6 +264,7 @@ sleep 2
|
||||
camera=$(request "$api/api/cameras/$camera_id")
|
||||
[[ $(jq -r '.status' <<<"$camera") == Disabled ]]
|
||||
wait_ack false
|
||||
wait_agent_reconnected_and_ack "$central_restart_started_ns" "$acknowledged_version"
|
||||
printf 'restart OFF persisted; camera config digest acknowledged\n'
|
||||
if (( contract_failures > 0 )); then
|
||||
printf 'contract failures=%s\n' "$contract_failures" >&2
|
||||
|
||||
Reference in new issue
Block a user