Skip to content

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

TypeScript

test(minikube): allow branch profile reuse across commits

Alfredo Lopez242ce0c0aed8
diff --git a/scripts/minikube/t2-common.sh b/scripts/minikube/t2-common.sh
index d5cb46f5e..6a4bda636 100755
--- a/scripts/minikube/t2-common.sh
+++ b/scripts/minikube/t2-common.sh
@@ -205,10 +205,10 @@ t2_profile_scope() {
T2_NEXT_COMMAND='regenerate the profile for the current branch'
t2_fail PROFILE_OWNERSHIP_MISMATCH 'profile branch does not match current branch'
fi
- if [[ "$T2_HEAD" != "$profile_sha"* ]]; then
- T2_NEXT_COMMAND='regenerate the profile for the current HEAD'
- t2_fail PROFILE_OWNERSHIP_MISMATCH 'profile SHA does not match current HEAD'
- fi
+ # A healthy branch-owned profile is reusable across commits. The cache SHA
+ # is historical naming metadata; exact runtime identity is enforced below
+ # by the pre-gate marker's gitHead/worktreeId pair, not by recreating a
+ # Minikube cluster for every commit.
if [ ! -f "$T2_PORTS_ENV" ]; then
T2_NEXT_COMMAND='generate the profile-owned random ports before starting a gate'
t2_fail DEVELOPMENT_SCOPE_REQUIRED "profile-owned ports.env is missing: $T2_PORTS_ENV"
diff --git a/scripts/tests/test-minikube-t2-scenarios.sh b/scripts/tests/test-minikube-t2-scenarios.sh
index 1ed5c5a82..fc823d8d1 100755
--- a/scripts/tests/test-minikube-t2-scenarios.sh
+++ b/scripts/tests/test-minikube-t2-scenarios.sh
@@ -34,6 +34,7 @@ expect_code() {
repo="$tmp/evenfire"
mkdir -p "$repo"
+repo="$(cd "$repo" && pwd -P)"
git init -q -b dev "$repo"
git -C "$repo" config user.email [email protected]
git -C "$repo" config user.name scenario-test
@@ -63,12 +64,14 @@ repo_env=(
T2_PROFILE_ROOT="$tmp/profiles"
T2_PROFILE_ENV="$profile_root/profile.env"
T2_PORTS_ENV="$profile_root/ports.env"
+ T2_BRANCH=feat/scenario
+ T2_HEAD="$feature_sha"
T2_LOCK_ROOT="$tmp/locks"
T2_EVIDENCE_ROOT="$tmp/evidence"
)
expect_code DEVELOPMENT_SCOPE_REQUIRED wrong-repository wrong-repository \
- env "${repo_env[@]}" bash -c 'git -C "$T2_PROJECT_DIR" remote set-url origin https://example.invalid/not-evenfire.git; source "$1"; t2_repo_metadata' bash "$COMMON"
+ env "${repo_env[@]}" bash -c 'git -C "$T2_PROJECT_DIR" remote set-url origin https://example.invalid/other-repository.git; source "$1"; t2_repo_metadata' bash "$COMMON"
git -C "$repo" remote set-url origin https://github.com/evenfire-ai/evenfire.git
git -C "$repo" branch main "$base_sha"
@@ -118,6 +121,12 @@ printf 'PROFILE=%s\nBRANCH=feat/scenario\nSHA_SHORT=%s\nDIRTY=false\nREPO_DIR=%s
expect_code PROFILE_OWNERSHIP_MISMATCH profile-ownership profile-ownership \
env "${ownership_env[@]}" bash -c 'source "$1"; t2_profile_scope' bash "$COMMON"
+stale_profile_env="$tmp/stale-profile.env"
+printf 'PROFILE=%s\nBRANCH=feat/scenario\nSHA_SHORT=oldsha1\nDIRTY=false\nREPO_DIR=%s\n' \
+ "$profile" "$repo" >"$stale_profile_env"
+env "${repo_env[@]}" T2_PROFILE_ENV="$stale_profile_env" \
+ bash -c 'source "$1"; t2_repo_metadata; t2_profile_scope' bash "$COMMON"
+
marker_env=("${repo_env[@]}" T2_HEAD="$feature_sha" T2_WORKTREE_ID=worktree-a)
expect_code HEAD_MARKER_MISMATCH stale-marker stale-marker \
env "${marker_env[@]}" FAKE_MARKER='{"data":{"clusterFingerprint":"fp","gitHead":"old","worktreeId":"worktree-a","imageSource":"local","imageTag":"test"}}' \