Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix(test): select source server and scope entitlement bootstrap

pulse-triage[bot]c9796373684a
diff --git a/tests/integration/scripts/run-tests-images.test.mjs b/tests/integration/scripts/run-tests-images.test.mjs
index 3bae84e28a..39b775b691 100644
--- a/tests/integration/scripts/run-tests-images.test.mjs
+++ b/tests/integration/scripts/run-tests-images.test.mjs
@@ -15,16 +15,24 @@ function run(failImage = '') {
try {
writeFileSync(path.join(dir, 'docker'), `#!/bin/bash
printf '%s\\n' "$*" >> "$CALL_LOG"
-if [ "$1 $2" = 'compose version' ]; then exit 0; fi
+if [ "$1 $2" = 'compose version' ]; then
+ printf 'target=%s command=%s file=%s path=%s skip=%s\\n' "$PULSE_E2E_PULSE_CONTAINER" "$PULSE_E2E_ENTITLEMENT_WRITE_COMMAND" "$PULSE_E2E_BILLING_STATE_PATH" "$PULSE_E2E_CONTAINER_BILLING_PATH" "$PULSE_E2E_SKIP_DOCKER" >> "$CALL_LOG"
+ exit 0
+fi
if [ "$1 $2" = 'image inspect' ]; then exit 0; fi
if [ "$1" = build ]; then
- [[ "$3" != "$FAIL_IMAGE":* ]]
+ [[ " $* " != *" -t $FAIL_IMAGE:"* ]]
exit $?
fi
exit 91
`, { mode: 0o755 });
const result = spawnSync('bash', [runner, failImage ? 'multi-tenant' : 'invalid-test-suite'], {
- env: { ...process.env, PATH: `${dir}:${process.env.PATH}`, CALL_LOG: log, FAIL_IMAGE: failImage },
+ env: { ...process.env, PATH: `${dir}:${process.env.PATH}`, CALL_LOG: log, FAIL_IMAGE: failImage,
+ PULSE_E2E_PULSE_CONTAINER: 'unowned-container',
+ PULSE_E2E_ENTITLEMENT_WRITE_COMMAND: 'unowned-command',
+ PULSE_E2E_BILLING_STATE_PATH: '/unowned/billing.json',
+ PULSE_E2E_CONTAINER_BILLING_PATH: '/unowned/billing.json',
+ PULSE_E2E_SKIP_DOCKER: 'true', },
encoding: 'utf8',
});
const project = result.stdout.match(/Isolated integration project: (pulse-e2e-[a-f0-9]+)/)?.[1];
@@ -40,7 +48,7 @@ test('rebuilds both test images from this checkout even when local tags exist',
assert.ok(result.stdout.includes('Unknown suite: invalid-test-suite'));
assert.deepEqual(result.calls.filter(call => call.startsWith('build ')), [
`build -t pulse-mock-github:${result.project} ${repo}/tests/integration/mock-github-server`,
- `build -t pulse:${result.project} --build-arg GO_BUILD_TAGS= -f ${repo}/Dockerfile ${repo}`,
+ `build --target e2e_runtime -t pulse:${result.project} --build-arg GO_BUILD_TAGS= -f ${repo}/Dockerfile ${repo}`,
]);
});
@@ -48,7 +56,7 @@ for (const image of ['pulse-mock-github', 'pulse']) {
test(`failed ${image} build cannot fall through to a cached image`, () => {
const result = run(image);
assert.equal(result.status, 1);
- assert.ok(result.calls.some(call => call.startsWith(`build -t ${image}:`)));
+ assert.ok(result.calls.some(call => call.startsWith('build ') && call.includes(`-t ${image}:`)));
assert.ok(!result.calls.some(call => call.includes(' up ')));
assert.ok(!result.stdout.includes('Starting test environment'));
});
@@ -67,3 +75,8 @@ test('failed startup cleanup is scoped to its own project', () => {
assert.ok(composeCalls.some(call => call.endsWith('down -v')));
for (const call of composeCalls) assert.ok(call.includes(`-p ${result.project} `));
});
+
+test('shell runner binds entitlement writes to its owned server and clears external overrides', () => {
+ const result = run();
+ assert.ok(result.calls.includes(`target=${result.project}-server command= file= path= skip=`));
+});
diff --git a/tests/integration/scripts/run-tests.sh b/tests/integration/scripts/run-tests.sh
index fff67dc8f0..fd0967d60e 100755
--- a/tests/integration/scripts/run-tests.sh
+++ b/tests/integration/scripts/run-tests.sh
@@ -34,6 +34,11 @@ export PULSE_E2E_MOCK_IMAGE="pulse-mock-github:$PULSE_E2E_RUN_ID"
export PULSE_E2E_SERVER_CONTAINER="$PULSE_E2E_RUN_ID-server"
export PULSE_E2E_MOCK_CONTAINER="$PULSE_E2E_RUN_ID-mock"
export PULSE_E2E_SEED_CONTAINER="$PULSE_E2E_RUN_ID-seed"
+# Entitlement bootstrap and browser helpers use this older variable name.
+# Do not let inherited live-runtime overrides redirect writes outside this run.
+export PULSE_E2E_PULSE_CONTAINER="$PULSE_E2E_SERVER_CONTAINER"
+unset PULSE_E2E_ENTITLEMENT_WRITE_COMMAND PULSE_E2E_BILLING_STATE_PATH
+unset PULSE_E2E_CONTAINER_BILLING_PATH PULSE_E2E_SKIP_DOCKER
export PULSE_E2E_PORT=0 PULSE_E2E_AGENT_PORT=0 PULSE_E2E_MOCK_GITHUB_PORT=0
echo "Isolated integration project: $PULSE_E2E_RUN_ID"
@@ -54,10 +59,12 @@ ensure_test_images() {
echo "Building test images from: $REPO_ROOT"
docker build -t "$PULSE_E2E_MOCK_IMAGE" "$TEST_ROOT/mock-github-server"
+ # Select the source-built server stage explicitly: the final Dockerfile
+ # stage is a prebuilt agent requiring a release_payload context.
# Test image drops the release build tag so the suite can enable mock
# fixtures without a demo entitlement. A build failure must stop the run,
# never fall back to a previously tagged image.
- docker build -t "$PULSE_E2E_SERVER_IMAGE" --build-arg GO_BUILD_TAGS="" -f "$REPO_ROOT/Dockerfile" "$REPO_ROOT"
+ docker build --target e2e_runtime -t "$PULSE_E2E_SERVER_IMAGE" --build-arg GO_BUILD_TAGS="" -f "$REPO_ROOT/Dockerfile" "$REPO_ROOT"
}
# EXIT also handles build/start/test failures; signals preserve failure status.