Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .superset/db-gate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if [ "$LIVE_PROVIDERS" = 1 ] && { [ -z "${LIVE_OPENROUTER_API_KEY:-}" ] || [ -z
exit 1
fi
stack_started=false
provider_started=false
runtime_dir=""
owned_pids=()

Expand All @@ -44,7 +45,10 @@ cleanup() {
trap - EXIT

stop_owned_processes
docker rm -f "$FAKE_PROVIDER" >/dev/null 2>&1 || true
# The container name is shared by every worktree, so only remove our own.
if [ "$provider_started" = true ]; then
docker rm -f "$FAKE_PROVIDER" >/dev/null 2>&1 || true
fi

if [ -n "$runtime_dir" ] && [ -f "$runtime_dir/function.env" ]; then
rm -- "$runtime_dir/function.env"
Expand Down Expand Up @@ -114,6 +118,7 @@ fi

# Edge Functions reach the fake provider by container name on the stack network.
docker rm -f "$FAKE_PROVIDER" >/dev/null 2>&1 || true
provider_started=true
docker run -d --rm --name "$FAKE_PROVIDER" --network "supabase_network_$project_id" \
"${provider_mode[@]}" -p 127.0.0.1:18090:8787 -v "$(pwd)/e2e/full-stack/fake-openrouter.mjs:/fake.mjs:ro" \
node:22-alpine node /fake.mjs >/dev/null
Expand Down
8 changes: 8 additions & 0 deletions src/test/scripts/db-gate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ it("stops local Supabase when database tests fail", async () => {
const bin = join(root, "bin");
const log = join(root, "calls.log");
await mkdir(bin);
// The gate's cleanup can remove the shared fake-provider container. A real
// docker here would kill a gate running in any other worktree, so log it instead.
await executable(
join(bin, "docker"),
'#!/usr/bin/env bash\nprintf "docker %s\\n" "$*" >> "$CALL_LOG"\n',
);
await executable(
join(bin, "supabase"),
'#!/usr/bin/env bash\nprintf "supabase %s\\n" "$*" >> "$CALL_LOG"\n',
Expand All @@ -37,6 +43,8 @@ it("stops local Supabase when database tests fail", async () => {
CALL_LOG: log,
HOME: root,
PATH: `${bin}:${process.env.PATH ?? ""}`,
TMPDIR: root,
WORKSPACE_GATE_ARTIFACT_ROOT: "",
},
});

Expand Down
Loading