Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(e2e): retain HCC proxy rollout diagnostics
Alfredo Lopez279c8bd161b1
diff --git a/scripts/e2e/e2e-hcc-communicationchannel-watch-recovery.sh b/scripts/e2e/e2e-hcc-communicationchannel-watch-recovery.shindex d1a38ed5b..cef9d1680 100755--- a/scripts/e2e/e2e-hcc-communicationchannel-watch-recovery.sh+++ b/scripts/e2e/e2e-hcc-communicationchannel-watch-recovery.sh@@ -75,6 +75,33 @@ HCC_GATE_FINALIZATION_FAILURE=""die() { fail "$*"; exit 1; }now_rfc3339() { date -u +"%Y-%m-%dT%H:%M:%SZ"; }+# This gate deliberately changes only the HCC Kubernetes API path. If its+# rollout fails before the normal recovery log stream starts, preserve the+# bounded pod state and both container log buffers that distinguish a proxy,+# policy, or process-startup failure. Cleanup still restores HCC afterwards.+print_hcc_proxy_rollout_diagnostics() {+ local pod++ echo "HCC proxy rollout diagnostics (before restoration):" >&2+ kctl get pods -n "$HCC_NS" -l "app=${HCC_DEPLOY}" -o json |+ jq -r '+ .items[] |+ .status.containerStatuses[]? |+ "pod=\(.metadata.name) phase=\(.status.phase // \"unknown\") ready=\(.ready) restarts=\(.restartCount) waiting=\(.state.waiting.reason // \"none\") terminated=\(.state.terminated.reason // \"none\") exitCode=\(.state.terminated.exitCode // \"none\") lastTerminated=\(.lastState.terminated.reason // \"none\") lastExitCode=\(.lastState.terminated.exitCode // \"none\")"+ ' >&2 || true++ while IFS= read -r pod; do+ [ -n "$pod" ] || continue+ echo "HCC proxy rollout previous logs for pod/${pod}:" >&2+ kctl logs "pod/${pod}" -n "$HCC_NS" -c host-context-controller \+ --previous --tail=120 >&2 || true+ echo "HCC proxy rollout current logs for pod/${pod}:" >&2+ kctl logs "pod/${pod}" -n "$HCC_NS" -c host-context-controller \+ --tail=120 >&2 || true+ done < <(kctl get pods -n "$HCC_NS" -l "app=${HCC_DEPLOY}" \+ -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' 2>/dev/null || true)+}+cleanup() {local status=$? cleanup_failed=0 restore_ok=1 host remainingset +e@@ -172,8 +199,10 @@ hcc_proxy_patch="$(jq -cn --arg ip "$PROXY_IP" '{spec:{template:{spec:{]}]}}}}')"kctl patch deployment "$HCC_DEPLOY" -n "$HCC_NS" --type=strategic -p "$hcc_proxy_patch" >/dev/null-kctl rollout status deployment "$HCC_DEPLOY" -n "$HCC_NS" --timeout=180s >/dev/null ||+if ! kctl rollout status deployment "$HCC_DEPLOY" -n "$HCC_NS" --timeout=180s >/dev/null; then+ print_hcc_proxy_rollout_diagnosticsdie "HCC did not become ready through the API proxy"+fiinitial_hcc_identity="$(wait_for_hcc_identity 30)" || die "could not capture HCC pod identity"read -r HCC_UID HCC_RESTARTS <<<"$initial_hcc_identity"[ -n "$HCC_UID" ] && [ "$HCC_UID" != invalid ] || die "could not capture HCC pod identity"diff --git a/scripts/tests/test-hcc-watch-recovery-gate.sh b/scripts/tests/test-hcc-watch-recovery-gate.shindex 7110a75d7..543455cee 100755--- a/scripts/tests/test-hcc-watch-recovery-gate.sh+++ b/scripts/tests/test-hcc-watch-recovery-gate.sh@@ -38,6 +38,21 @@ elsefail "CommunicationChannel gate target omits exact pre-gate or profile ownership"fi+proxy_rollout_function="$(+ sed -n '/^print_hcc_proxy_rollout_diagnostics() {$/,/^}$/p' "$WATCH_GATE"+)"+# Literal source-code assertions.+# shellcheck disable=SC2016+if [[ "$proxy_rollout_function" == *'kctl get pods'* ]] &&+ [[ "$proxy_rollout_function" == *'--previous --tail=120'* ]] &&+ [[ "$proxy_rollout_function" == *'status.containerStatuses'* ]] &&+ grep -Fq 'if ! kctl rollout status deployment "$HCC_DEPLOY"' "$WATCH_GATE" &&+ [ "$(grep -Fc 'print_hcc_proxy_rollout_diagnostics' "$WATCH_GATE")" = 2 ]; then+ pass "proxy rollout failure emits bounded HCC pod and previous-container diagnostics"+else+ fail "proxy rollout failure can discard the distinguishing HCC startup evidence"+fi+if grep -Fq 'source "${SCRIPT_DIR}/_lib/hcc-watch-recovery-fixture.sh"' "$READINESS_GATE" &&[ "$(grep -Fc 'require_branch_owned_hcc_gate "$HCC_NS"' "$READINESS_GATE")" = 1 ] &&! grep -Fq 'HCC_BRANCH_GATE_SYNC_MARKER' "$READINESS_GATE" &&