From 817646d2372918a235849d5cee8a209f338048f0 Mon Sep 17 00:00:00 2001 From: Sergio Arroutbi Date: Thu, 21 May 2026 17:01:43 +0200 Subject: [PATCH] Isolate integration test settings to prevent clobbering user config The curl integration tests issue PUT requests to /api/settings/keylime and /api/settings/certificates, which trigger persist_settings() and overwrite ~/.config/keylime-webtool/settings.toml. This silently replaces the user's real Verifier/Registrar URLs with Mockoon test values and deletes the mTLS certificate configuration, causing real Keylime services to appear as DOWN after every pre-commit run. Set KEYLIME_WEBTOOL_CONFIG to a temporary file before starting the test backend so all settings writes go to an isolated location. The temp file is removed in the cleanup trap. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Sergio Arroutbi --- tests/curl_integration_test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/curl_integration_test.sh b/tests/curl_integration_test.sh index ea92eab..1313b07 100755 --- a/tests/curl_integration_test.sh +++ b/tests/curl_integration_test.sh @@ -120,6 +120,7 @@ cleanup() { [ -n "${BACKEND_PID:-}" ] && kill "$BACKEND_PID" 2>/dev/null || true [ -n "${MOCKOON_VERIFIER_PID:-}" ] && kill "$MOCKOON_VERIFIER_PID" 2>/dev/null || true [ -n "${MOCKOON_REGISTRAR_PID:-}" ] && kill "$MOCKOON_REGISTRAR_PID" 2>/dev/null || true + [ -n "${TEST_CONFIG:-}" ] && rm -f "$TEST_CONFIG" || true wait 2>/dev/null || true } @@ -333,6 +334,8 @@ if [ "$NO_MOCKS" = false ]; then cargo build --quiet 2>&1 echo "-------- Starting backend" + TEST_CONFIG="$(mktemp "${GIT_ROOT}/.test-settings-XXXXXX.toml")" + export KEYLIME_WEBTOOL_CONFIG="$TEST_CONFIG" RUST_LOG=info cargo run --quiet & BACKEND_PID=$!