Public dry run dryrun-309831e1e021
Source commit: 309831e1e021f962c118452336776fd9a94025f9 Public tree identity: sha256:6fa95c1745579bd6256dbeb3d476db0b07c2f24aa9213b0f7783ce1adfc8aca5
This commit is contained in:
commit
f22d0a5791
113 changed files with 39348 additions and 0 deletions
80
scripts/podman-backend-smoke.js
Executable file
80
scripts/podman-backend-smoke.js
Executable file
|
|
@ -0,0 +1,80 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const assert = require("assert");
|
||||
const cp = require("child_process");
|
||||
const path = require("path");
|
||||
|
||||
const repo = path.resolve(__dirname, "..");
|
||||
const baseImage = "docker.io/library/alpine:3.20";
|
||||
|
||||
function run(command, args, options = {}) {
|
||||
return cp.execFileSync(command, args, {
|
||||
cwd: repo,
|
||||
encoding: "utf8",
|
||||
stdio: options.stdio || ["ignore", "pipe", "pipe"]
|
||||
});
|
||||
}
|
||||
|
||||
function incomplete(reason) {
|
||||
const error = new Error(`Linux Podman backend incomplete: ${reason}`);
|
||||
error.code = "DISASMER_PODMAN_INCOMPLETE";
|
||||
throw error;
|
||||
}
|
||||
|
||||
function ensurePodmanBaseImage() {
|
||||
try {
|
||||
run("podman", ["--version"]);
|
||||
} catch (error) {
|
||||
incomplete(`podman command is unavailable (${error.message})`);
|
||||
}
|
||||
|
||||
let rootless;
|
||||
try {
|
||||
rootless = run("podman", ["info", "--format", "{{.Host.Security.Rootless}}"]).trim();
|
||||
} catch (error) {
|
||||
incomplete(`podman info did not report rootless status (${error.message})`);
|
||||
}
|
||||
if (rootless !== "true") {
|
||||
incomplete(`podman is not running in rootless mode (reported ${JSON.stringify(rootless)})`);
|
||||
}
|
||||
|
||||
try {
|
||||
run("podman", ["image", "exists", baseImage]);
|
||||
} catch (_) {
|
||||
try {
|
||||
run("podman", ["pull", baseImage], { stdio: "inherit" });
|
||||
} catch (error) {
|
||||
incomplete(`unable to make ${baseImage} available (${error.message})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ensurePodmanBaseImage();
|
||||
|
||||
const stdout = run("cargo", [
|
||||
"run",
|
||||
"-q",
|
||||
"-p",
|
||||
"disasmer-node",
|
||||
"--bin",
|
||||
"disasmer-podman-smoke"
|
||||
]);
|
||||
const report = JSON.parse(stdout.trim().split("\n").at(-1));
|
||||
|
||||
assert.strictEqual(report.podman_status, "completed");
|
||||
assert.strictEqual(report.status_code, 0);
|
||||
assert.strictEqual(report.stdout, "podman-ok:node-local source\n");
|
||||
assert.strictEqual(report.large_bytes_uploaded, false);
|
||||
assert.strictEqual(report.uses_full_repo_tarball, false);
|
||||
assert.strictEqual(report.coordinator_routed_file_reads, false);
|
||||
assert.strictEqual(report.staged_artifact.path, "/vfs/artifacts/podman-smoke.txt");
|
||||
|
||||
console.log("Podman backend smoke passed");
|
||||
} catch (error) {
|
||||
if (error.code === "DISASMER_PODMAN_INCOMPLETE") {
|
||||
console.error(error.message);
|
||||
process.exit(2);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue