Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(e2e): repair HCC readiness gate contracts
Alfredo Lopez72fb3b763c06
diff --git a/scripts/e2e/measure-host-bundle-reconcile.sh b/scripts/e2e/measure-host-bundle-reconcile.shindex 1eb66d287..175a15af8 100755--- a/scripts/e2e/measure-host-bundle-reconcile.sh+++ b/scripts/e2e/measure-host-bundle-reconcile.sh@@ -151,9 +151,10 @@ readonly DELPASS_RESURRECTION_SETTLE_S=30 # quiet window before re-asserting# termination grace. A child with NO deletionTimestamp never gets this# extension (the delete was never issued → immediate fail).readonly MEASURE_TEARDOWN_CONVERGE_S=120-# Exact log lines emitted by host-context-controller/src/k8sClient.ts for-# the startup full fleet pass (reason string 'initial Host reconciliation').-readonly HCC_PASS_STARTED_MARKER='Running initial Host reconciliation'+# The startup marker is emitted immediately before the cold-start Host+# inventory/watch recovery. COMPLETE/FAIL below retain the precise+# 'initial Host reconciliation' reason supplied to the fleet pass.+readonly HCC_PASS_STARTED_MARKER='Starting initial Host background convergence'readonly HCC_PASS_COMPLETED_MARKER='Completed Host reconciliation after initial Host reconciliation'readonly HCC_PASS_FAILED_MARKER='Host reconciliation after initial Host reconciliation failed'diff --git a/scripts/tests/test-hcc-api-gateway-readiness.sh b/scripts/tests/test-hcc-api-gateway-readiness.shindex 7588248fd..ce2930e86 100755--- a/scripts/tests/test-hcc-api-gateway-readiness.sh+++ b/scripts/tests/test-hcc-api-gateway-readiness.sh@@ -88,6 +88,45 @@ if [[ "${runtime_hold_function}" != *'hcc_gateway_deployment_ready'* ]] ||fiecho "PASS: bootstrap E2E proves gateway readiness remains local while HCC is unavailable"+# Exercise the full conjunction with a bounded synthetic clock. Each required+# observation must independently fail the hold; this kills a permissive+# && -> || mutation without requiring a cluster or a real sleep.+gateway_hold_case() (+ local failed_observation=$1 clock_file+ clock_file="$(mktemp "${TMPDIR:-/tmp}/hcc-gateway-clock.XXXXXX")"+ printf '%s' 0 >"$clock_file"+ trap 'rm -f "$clock_file"' EXIT+ HCC_NS=control-plane+ date() {+ local calls+ calls="$(<"$clock_file")"+ calls=$((calls + 1))+ printf '%s' "$calls" >"$clock_file"+ [ "$calls" -le 2 ] && printf '%s\n' 0 || printf '%s\n' 1+ }+ sleep() { :; }+ hcc_gateway_deployment_ready() {+ [ "$failed_observation" != deployment ]+ }+ hcc_gateway_local_health_ok() {+ [ "$failed_observation" != health ]+ }+ hcc_gateway_ready_proxy_unavailable() {+ [ "$failed_observation" != proxy ]+ }+ eval "${runtime_hold_function}"+ hcc_gateway_remains_ready_without_hcc 1+)++if gateway_hold_case none &&+ ! gateway_hold_case deployment &&+ ! gateway_hold_case health &&+ ! gateway_hold_case proxy; then+ echo "PASS: gateway hold requires every readiness, health, and proxy-unavailable observation"+else+ fail "gateway hold can accept a failed readiness, health, or proxy observation"+fi+for unavailable_status in 502 503 504; doif (HCC_NS=control-planediff --git a/scripts/tests/test-hcc-watch-recovery-gate.sh b/scripts/tests/test-hcc-watch-recovery-gate.shindex c6494f6fa..aa08da9d5 100755--- a/scripts/tests/test-hcc-watch-recovery-gate.sh+++ b/scripts/tests/test-hcc-watch-recovery-gate.sh@@ -10,6 +10,7 @@ SCRIPT_DIR="${ROOT}/scripts/e2e"WATCH_GATE="${SCRIPT_DIR}/e2e-hcc-communicationchannel-watch-recovery.sh"READINESS_GATE="${SCRIPT_DIR}/e2e-hcc-readiness-bootstrap.sh"MCP_READINESS_GATE="${SCRIPT_DIR}/e2e-hcc-mcp-context-readiness.sh"+HOST_BUNDLE_MEASURE="${SCRIPT_DIR}/measure-host-bundle-reconcile.sh"GATES=("$WATCH_GATE" "$READINESS_GATE" "$MCP_READINESS_GATE")LOCK_HELPER="${SCRIPT_DIR}/_lib/hcc-watch-recovery-lock.sh"LOG_HELPER="${SCRIPT_DIR}/_lib/hcc-watch-recovery-logs.sh"@@ -567,6 +568,29 @@ if (elsefail "exact Kubernetes readiness rejects current Ready HCC evidence"fi+if (+ NEW_HCC_POD=hcc-pod+ HCC_UID=pod-uid+ HCC_NS=control-plane+ HCC_DEPLOY='host-context-controller'+ kctl() {+ case "$2" in+ pod)+ printf '%s\n' '{"metadata":{"uid":"pod-uid"},"status":{"conditions":[{"type":"Ready","status":"False"}],"containerStatuses":[{"name":"host-context-controller","ready":true}]}}'+ ;;+ deployment)+ printf '%s\n' '{"metadata":{"generation":4},"spec":{"replicas":1},"status":{"observedGeneration":4,"updatedReplicas":1,"readyReplicas":1,"availableReplicas":1,"unavailableReplicas":0}}'+ ;;+ *) return 1 ;;+ esac+ }+ eval "$hcc_kubernetes_readiness_function"+ ! hcc_kubernetes_readiness_is_exact+); then+ pass "exact Kubernetes readiness rejects a current pod whose Ready condition is False"+else+ fail "exact Kubernetes readiness can accept a non-Ready HCC pod"+fiif (NEW_HCC_POD=hcc-podHCC_UID=pod-uid@@ -1104,6 +1128,17 @@ if grep -Fq 'Starting initial Host background convergence...' \elsefail "bootstrap Host pass markers drifted from their runtime producer or reason binding"fi++# The destructive Host-bundle measurement uses the same cold-start transition+# as the bootstrap readiness gate. Keep its active-pass marker tied to the+# emitted producer rather than an obsolete reason-string log line.+if grep -Fq "readonly HCC_PASS_STARTED_MARKER='Starting initial Host background convergence'" \+ "$HOST_BUNDLE_MEASURE" &&+ grep -Fq 'Starting initial Host background convergence...' "$HCC_K8S_CLIENT"; then+ pass "Host-bundle measurement START marker remains bound to the cold-start producer"+else+ fail "Host-bundle measurement can wait for a stale HCC START marker"+fi# shellcheck disable=SC2016probe_result_line="$(grep -nF 'probe_result="$(kctl exec' "$READINESS_GATE" | cut -d: -f1)"# shellcheck disable=SC2016diff --git a/scripts/tests/test-lint-networkpolicies.sh b/scripts/tests/test-lint-networkpolicies.shindex 2400d8517..9cdd5f06b 100755--- a/scripts/tests/test-lint-networkpolicies.sh+++ b/scripts/tests/test-lint-networkpolicies.sh@@ -62,7 +62,7 @@ write_policy "${TMP_DIR}/safe-specific.yaml" ' - ports:protocol: TCPto:- ipBlock:- cidr: 203.0.113.10/32'+ cidr: 198.51.100.10/32'run_lint "${TMP_DIR}/safe-specific.yaml" >/dev/nullecho "PASS: lint-networkpolicies allows explicit port plus specific destination"@@ -135,8 +135,8 @@ ${PUBLIC_EXCEPT_BLOCK}"run_lint "${TMP_DIR}/public-with-excepts.yaml" >/dev/nullecho "PASS: lint-networkpolicies allows public-only exception set with explicit ports"-GCP_DEV_RENDERED="${TMP_DIR}/gcp-dev-rendered.yaml"-kubectl kustomize "${ROOT}/deploy/overlays/gcp-dev" >"${GCP_DEV_RENDERED}"+MINIKUBE_RENDERED="${TMP_DIR}/minikube-rendered.yaml"+kubectl kustomize "${ROOT}/deploy/overlays/minikube" >"${MINIKUBE_RENDERED}"RUBYOPT=--disable=gems ruby -ryaml -e 'forbidden = %w[allow-dns-egress-sandbox-ui deny-all-sandbox-ui]required = %w[sandbox-ui-static-deny-all sandbox-ui-static-dns-egress]@@ -151,7 +151,6 @@ RUBYOPT=--disable=gems ruby -ryaml -e 'found << name if forbidden.include?(name)if name == "sandbox-ui-static-dns-egress"saw_dns_peer = false- saw_dns_ipblock = falseArray(doc.dig("spec", "egress")).each_with_index do |rule, rule_idx|ports = Array(rule["ports"]).map { |port| [port.fetch("protocol", "TCP"), port["port"]] }.sortexpected_ports = [["TCP", 53], ["UDP", 53]]@@ -164,27 +163,20 @@ RUBYOPT=--disable=gems ruby -ryaml -e 'peers.each_with_index do |peer, peer_idx|ns_name = peer.dig("namespaceSelector", "matchLabels", "kubernetes.io/metadata.name")dns_selector = peer.dig("podSelector", "matchLabels", "k8s-app")- dns_ipblock = peer.dig("ipBlock", "cidr")if ns_name == "kube-system" && dns_selector == "kube-dns"saw_dns_peer = truenextend- if dns_ipblock == "203.0.113.10/32"- saw_dns_ipblock = true- next- end-- abort("sandbox-ui static DNS egress peer #{rule_idx}/#{peer_idx} must stay scoped to kube-system kube-dns pods or the example-dev kube-dns ClusterIP")+ abort("sandbox-ui static DNS egress peer #{rule_idx}/#{peer_idx} must stay scoped to kube-system kube-dns pods")endendabort("sandbox-ui static DNS egress must include a kube-system kube-dns peer") unless saw_dns_peer- abort("sandbox-ui static DNS egress must include the example-dev kube-dns ClusterIP") unless saw_dns_ipblockendendabort("sandbox-ui static slice must not render HCC-owned policies: #{found.join(", ")}") unless found.empty?missing = required - namesabort("sandbox-ui static slice must render renamed baseline policies: #{missing.join(", ")}") unless missing.empty?-' "${GCP_DEV_RENDERED}"-echo "PASS: gcp-dev sandbox-ui static policies do not take HCC-owned deny-all/DNS ownership and include kube-dns ClusterIP"+' "${MINIKUBE_RENDERED}"+echo "PASS: minikube sandbox-ui static policies do not take HCC-owned deny-all/DNS ownership and retain kube-dns-only DNS egress"