mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
test: add regression tests for building docker containers (#25210)
This commit is contained in:
@@ -71,6 +71,7 @@ ENV PATH "${PATH}:/usr/local/bun-node-fallback-bin"
|
||||
|
||||
# Temporarily use the `build`-stage image binaries to create a symlink:
|
||||
RUN --mount=type=bind,from=build,source=/usr/bin,target=/usr/bin \
|
||||
--mount=type=bind,from=build,source=/etc/alternatives/which,target=/etc/alternatives/which \
|
||||
--mount=type=bind,from=build,source=/bin,target=/bin \
|
||||
--mount=type=bind,from=build,source=/usr/lib,target=/usr/lib \
|
||||
--mount=type=bind,from=build,source=/lib,target=/lib \
|
||||
|
||||
@@ -77,9 +77,8 @@ const testTimeout = 3 * 60_000;
|
||||
const integrationTimeout = 5 * 60_000;
|
||||
|
||||
function getNodeParallelTestTimeout(testPath) {
|
||||
if (testPath.includes("test-dns")) {
|
||||
return 90_000;
|
||||
}
|
||||
if (testPath.includes("test-dns")) return 60_000;
|
||||
if (testPath.includes("-docker-")) return 60_000;
|
||||
if (!isCI) return 60_000; // everything slower in debug mode
|
||||
if (options["step"]?.includes("-asan-")) return 60_000;
|
||||
return 20_000;
|
||||
|
||||
17
test/js/bun/test/parallel/test-docker-build-alpine.ts
Normal file
17
test/js/bun/test/parallel/test-docker-build-alpine.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { expect } from "bun:test";
|
||||
import { bunEnv, dockerExe, isDockerEnabled } from "harness";
|
||||
import { resolve } from "path";
|
||||
|
||||
if (isDockerEnabled()) {
|
||||
const docker = dockerExe()!;
|
||||
const cwd = resolve(import.meta.dir, "..", "..", "..", "..", "..", "dockerhub", "alpine");
|
||||
const proc = Bun.spawn({
|
||||
cmd: [docker, "build", "--progress=plain", "--no-cache", "--rm", "."],
|
||||
stdio: ["ignore", "inherit", "inherit"],
|
||||
cwd,
|
||||
env: bunEnv,
|
||||
});
|
||||
await proc.exited;
|
||||
expect(proc.signalCode).toBeNull();
|
||||
expect(proc.exitCode).toBe(0);
|
||||
}
|
||||
17
test/js/bun/test/parallel/test-docker-build-debian-slim.ts
Normal file
17
test/js/bun/test/parallel/test-docker-build-debian-slim.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { expect } from "bun:test";
|
||||
import { bunEnv, dockerExe, isDockerEnabled } from "harness";
|
||||
import { resolve } from "path";
|
||||
|
||||
if (isDockerEnabled()) {
|
||||
const docker = dockerExe()!;
|
||||
const cwd = resolve(import.meta.dir, "..", "..", "..", "..", "..", "dockerhub", "debian-slim");
|
||||
const proc = Bun.spawn({
|
||||
cmd: [docker, "build", "--progress=plain", "--no-cache", "--rm", "."],
|
||||
stdio: ["ignore", "inherit", "inherit"],
|
||||
cwd,
|
||||
env: bunEnv,
|
||||
});
|
||||
await proc.exited;
|
||||
expect(proc.signalCode).toBeNull();
|
||||
expect(proc.exitCode).toBe(0);
|
||||
}
|
||||
17
test/js/bun/test/parallel/test-docker-build-debian.ts
Normal file
17
test/js/bun/test/parallel/test-docker-build-debian.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { expect } from "bun:test";
|
||||
import { bunEnv, dockerExe, isDockerEnabled } from "harness";
|
||||
import { resolve } from "path";
|
||||
|
||||
if (isDockerEnabled()) {
|
||||
const docker = dockerExe()!;
|
||||
const cwd = resolve(import.meta.dir, "..", "..", "..", "..", "..", "dockerhub", "debian");
|
||||
const proc = Bun.spawn({
|
||||
cmd: [docker, "build", "--progress=plain", "--no-cache", "--rm", "."],
|
||||
stdio: ["ignore", "inherit", "inherit"],
|
||||
cwd,
|
||||
env: bunEnv,
|
||||
});
|
||||
await proc.exited;
|
||||
expect(proc.signalCode).toBeNull();
|
||||
expect(proc.exitCode).toBe(0);
|
||||
}
|
||||
17
test/js/bun/test/parallel/test-docker-build-distroless.ts
Normal file
17
test/js/bun/test/parallel/test-docker-build-distroless.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { expect } from "bun:test";
|
||||
import { bunEnv, dockerExe, isDockerEnabled } from "harness";
|
||||
import { resolve } from "path";
|
||||
|
||||
if (isDockerEnabled()) {
|
||||
const docker = dockerExe()!;
|
||||
const cwd = resolve(import.meta.dir, "..", "..", "..", "..", "..", "dockerhub", "distroless");
|
||||
const proc = Bun.spawn({
|
||||
cmd: [docker, "build", "--progress=plain", "--no-cache", "--rm", "."],
|
||||
stdio: ["ignore", "inherit", "inherit"],
|
||||
cwd,
|
||||
env: bunEnv,
|
||||
});
|
||||
await proc.exited;
|
||||
expect(proc.signalCode).toBeNull();
|
||||
expect(proc.exitCode).toBe(0);
|
||||
}
|
||||
Reference in New Issue
Block a user