Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(np08): bind markers to generated profile inputs

Alfredo Lopez97c297005236
diff --git a/scripts/minikube/pre-gate-sync.sh b/scripts/minikube/pre-gate-sync.sh
index 04ef78cfc..7694c73b5 100755
--- a/scripts/minikube/pre-gate-sync.sh
+++ b/scripts/minikube/pre-gate-sync.sh
@@ -534,6 +534,18 @@ if [[ "${cluster_changed}" == "true" ]]; then
"${SCRIPT_DIR}/pf-all-stack.sh"
fi
+ # Full deploy may regenerate ignored, profile-specific inputs such as the
+ # Kubernetes API-IP patch. Recompute after that generation and before
+ # stamping the marker; otherwise a strict consumer can correctly reject a
+ # marker that describes the pre-generation tree.
+ if ! cluster_fingerprint="$(pre_gate_marker_cluster_fingerprint "${PROJECT_DIR}")"; then
+ log "ERROR: unable to recompute the cluster fingerprint after deployment; refusing to stamp the marker"
+ exit 1
+ fi
+ if ! infra_fingerprint="$(pre_gate_marker_infra_fingerprint "${PROJECT_DIR}")"; then
+ log "ERROR: unable to recompute the infrastructure fingerprint after deployment; refusing to stamp the marker"
+ exit 1
+ fi
persist_cluster_marker "${cluster_fingerprint}" "${infra_fingerprint}"
persist_state cluster "${cluster_fingerprint}"
persist_state infra "${infra_fingerprint}"
diff --git a/scripts/tests/test-minikube-pre-gate-shadow.sh b/scripts/tests/test-minikube-pre-gate-shadow.sh
index 060a0ee97..e93568dfb 100755
--- a/scripts/tests/test-minikube-pre-gate-shadow.sh
+++ b/scripts/tests/test-minikube-pre-gate-shadow.sh
@@ -619,7 +619,7 @@ assert_the_migration_job_renders_the_overlay_the_cluster_runs() {
if [ "$rc" -eq 0 ] \
&& grep -q "renderDir=.*/deploy/overlays/minikube-ghcr" <<< "$out" \
&& grep -Fq 'newTag: latest' "$(grep -o 'renderDir=.*' <<< "$out" | head -1 | cut -d= -f2-)/../../components/ghcr-images/kustomization.yaml" \
- && ! grep -Fq "$hardcoded" "$REPO_ROOT/scripts/minikube/pre-gate-sync.sh" \
+ && ! grep -Fq -- "$hardcoded" "$REPO_ROOT/scripts/minikube/pre-gate-sync.sh" \
&& grep -Fq -- '--overlay "${PRE_GATE_RENDER_DIR}"' "$REPO_ROOT/scripts/minikube/pre-gate-sync.sh"; then
pass "the migration Job renders the overlay (and tag) the cluster actually runs"
else
diff --git a/scripts/tests/test-minikube-pre-gate-sync-state.sh b/scripts/tests/test-minikube-pre-gate-sync-state.sh
index ffd66b0f1..0affe5460 100755
--- a/scripts/tests/test-minikube-pre-gate-sync-state.sh
+++ b/scripts/tests/test-minikube-pre-gate-sync-state.sh
@@ -184,6 +184,19 @@ else
fail "pre-gate sync does not build workflow-runtime-core before dependent package tests"
fi
+final_cluster_fingerprint_line="$(grep -n 'cluster_fingerprint=.*pre_gate_marker_cluster_fingerprint' "$SCRIPT" | tail -n 1 | cut -d: -f1)"
+final_infra_fingerprint_line="$(grep -n 'infra_fingerprint=.*pre_gate_marker_infra_fingerprint' "$SCRIPT" | tail -n 1 | cut -d: -f1)"
+persist_marker_line="$(grep -nF 'persist_cluster_marker "${cluster_fingerprint}" "${infra_fingerprint}"' "$SCRIPT" | tail -n 1 | cut -d: -f1)"
+if [ -n "$final_cluster_fingerprint_line" ] &&
+ [ -n "$final_infra_fingerprint_line" ] &&
+ [ -n "$persist_marker_line" ] &&
+ [ "$final_cluster_fingerprint_line" -lt "$persist_marker_line" ] &&
+ [ "$final_infra_fingerprint_line" -lt "$persist_marker_line" ]; then
+ pass "pre-gate recomputes both fingerprints after generated deploy inputs before stamping the marker"
+else
+ fail "pre-gate can stamp a marker from fingerprints computed before generated deploy inputs"
+fi
+
marker_failure_dir="$(mktemp -d)"
mkdir -p "${marker_failure_dir}/bin" "${marker_failure_dir}/repo/control-api"
printf '#!/usr/bin/env bash\nexit 42\n' >"${marker_failure_dir}/bin/find"