Skip to content

Commit d1c9380

Browse files
committed
🤖 test: run DockerRuntime against existing ssh fixture container
Removes the extra DockerRuntime container fixture and instead runs DockerRuntime integration cases by docker-exec'ing into the already-running SSH fixture container. This avoids additional container startup/teardown overhead in CI while still exercising DockerRuntime behavior.
1 parent 992cf3e commit d1c9380

File tree

3 files changed

+13
-117
lines changed

3 files changed

+13
-117
lines changed

tests/runtime/runtime.test.ts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ import {
2424
stopSSHServer,
2525
type SSHServerConfig,
2626
} from "./test-fixtures/ssh-fixture";
27-
import {
28-
startDockerRuntimeContainer,
29-
stopDockerRuntimeContainer,
30-
type DockerRuntimeTestConfig,
31-
} from "./test-fixtures/docker-fixture";
3227
import { createTestRuntime, TestWorkspace, type RuntimeType } from "./test-fixtures/test-helpers";
3328
import { execBuffered, readFileString, writeFileString } from "@/node/utils/runtime/helpers";
3429
import type { Runtime } from "@/node/runtime/Runtime";
@@ -40,9 +35,6 @@ const describeIntegration = shouldRunIntegrationTests() ? describe : describe.sk
4035
// SSH server config (shared across all tests)
4136
let sshConfig: SSHServerConfig | undefined;
4237

43-
// DockerRuntime container config (shared across all tests)
44-
let dockerConfig: DockerRuntimeTestConfig | undefined;
45-
4638
describeIntegration("Runtime integration tests", () => {
4739
beforeAll(async () => {
4840
// Check if Docker is available (required for SSH tests)
@@ -56,18 +48,9 @@ describeIntegration("Runtime integration tests", () => {
5648
console.log("Starting SSH server container...");
5749
sshConfig = await startSSHServer();
5850
console.log(`SSH server ready on port ${sshConfig.port}`);
59-
60-
console.log("Starting DockerRuntime test container...");
61-
dockerConfig = await startDockerRuntimeContainer();
62-
console.log(`DockerRuntime container ready: ${dockerConfig.containerName}`);
6351
}, 120000); // 120s timeout for Docker build/start operations
6452

6553
afterAll(async () => {
66-
if (dockerConfig) {
67-
console.log("Stopping DockerRuntime test container...");
68-
await stopDockerRuntimeContainer(dockerConfig);
69-
}
70-
7154
if (sshConfig) {
7255
console.log("Stopping SSH server container...");
7356
await stopSSHServer(sshConfig);
@@ -95,7 +78,14 @@ describeIntegration("Runtime integration tests", () => {
9578
// time budget. Keep the Docker coverage focused on the core Runtime contract.
9679
const describeNonDocker = type === "docker" ? describe.skip : describe;
9780
const createRuntime = (): Runtime =>
98-
createTestRuntime(type, getBaseWorkdir(), sshConfig, dockerConfig);
81+
createTestRuntime(
82+
type,
83+
getBaseWorkdir(),
84+
sshConfig,
85+
type === "docker"
86+
? { image: "mux-ssh-test", containerName: sshConfig!.containerId }
87+
: undefined
88+
);
9989

10090
describe("exec() - Command execution", () => {
10191
test.concurrent("captures stdout and stderr separately", async () => {

tests/runtime/test-fixtures/docker-fixture.ts

Lines changed: 0 additions & 98 deletions
This file was deleted.

tests/runtime/test-fixtures/test-helpers.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ import * as path from "path";
99
import type { Runtime } from "@/node/runtime/Runtime";
1010
import { WorktreeRuntime } from "@/node/runtime/WorktreeRuntime";
1111
import { DockerRuntime } from "@/node/runtime/DockerRuntime";
12-
import type { DockerRuntimeTestConfig } from "./docker-fixture";
1312
import { SSHRuntime } from "@/node/runtime/SSHRuntime";
1413
import type { SSHServerConfig } from "./ssh-fixture";
1514

1615
/**
1716
* Runtime type for test matrix
1817
* Note: "local" here means worktree runtime (isolated git worktrees), not project-dir runtime
1918
*/
19+
20+
export interface DockerRuntimeTestConfig {
21+
image: string;
22+
containerName: string;
23+
}
2024
export type RuntimeType = "local" | "ssh" | "docker";
2125

2226
/**

0 commit comments

Comments
 (0)