Skip to content

Commit 1271a28

Browse files
committed
fix e2e tests
1 parent 3e8dc96 commit 1271a28

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ jobs:
3131
deno-version: v2.x
3232
- name: Compile binary
3333
run: make compile OUTPUT=decker
34+
- name: Start podman API socket
35+
# The podman renderer mounts the rootless API socket (for Dozzle); the
36+
# runner doesn't start it by default. Best-effort — the launch test
37+
# skips itself if the socket still isn't up, so this can't wedge CI.
38+
run: |
39+
systemctl --user enable --now podman.socket || true
40+
podman info --format 'socket={{.Host.RemoteSocket.Path}} exists={{.Host.RemoteSocket.Exists}}' || true
3441
- name: E2E
3542
# Test the real compiled artifact, the way users run it.
3643
env:

e2e/helpers.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,17 @@ export const project: P = { decker: { source: ${JSON.stringify(REPO_ROOT)}, ref:
5353
await Deno.writeTextFile(join(dir, "decker.ts"), body);
5454
}
5555

56-
export async function has(bin: string): Promise<boolean> {
56+
// The podman renderer bind-mounts the rootless API socket (for the Dozzle log
57+
// viewer), so a real launch needs the socket service running, not just the
58+
// podman binary. This reports exactly that.
59+
export async function hasPodmanSocket(): Promise<boolean> {
5760
try {
58-
const { code } = await new Deno.Command(bin, { args: ["--version"], stdout: "null", stderr: "null" }).output();
59-
return code === 0;
61+
const { code, stdout } = await new Deno.Command("podman", {
62+
args: ["info", "--format", "{{.Host.RemoteSocket.Exists}}"],
63+
stdout: "piped",
64+
stderr: "null",
65+
}).output();
66+
return code === 0 && new TextDecoder().decode(stdout).trim() === "true";
6067
} catch {
6168
return false;
6269
}

e2e/launch_test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { assertEquals } from "jsr:@std/assert@^1.0.0";
22
import { join } from "jsr:@std/path@^1.0.0";
3-
import { has, REPO_ROOT, runDecker, withTmp } from "./helpers.ts";
3+
import { hasPodmanSocket, REPO_ROOT, runDecker, withTmp } from "./helpers.ts";
44

55
const FIXTURE = join(REPO_ROOT, "e2e", "fixtures", "minimal.ts");
66

7-
// A real launch needs podman (the default pods renderer). Skipped when podman
8-
// is absent so local `deno test` and forks stay green; CI runs it.
7+
// A real launch needs the rootless podman API socket running (the renderer
8+
// mounts it for Dozzle). Skipped when it isn't, so local `deno test` and forks
9+
// stay green; CI starts the socket so this runs there.
910
Deno.test({
1011
name: "up/down: launches and tears down a minimal busybox pod",
11-
ignore: !(await has("podman")),
12+
ignore: !(await hasPodmanSocket()),
1213
fn: async () => {
1314
await withTmp(async (root) => {
1415
const env = { DECKER_ROOT: root };

0 commit comments

Comments
 (0)