27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
import { spawnSync } from "node:child_process";
|
|
|
|
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), "blender-ci-failure-"));
|
|
const reportPath = path.join(temporary, "quick-failure.json");
|
|
try {
|
|
const result = spawnSync(process.execPath, [new URL("./run-ci-lane.mjs", import.meta.url).pathname, "quick", "--self-test-failure"], {
|
|
encoding: "utf8",
|
|
env: { ...process.env, CI_REPORT_PATH: reportPath },
|
|
});
|
|
assert.notEqual(result.status, 0, "injected lane failure returned success");
|
|
const report = JSON.parse(fs.readFileSync(reportPath, "utf8"));
|
|
assert.equal(report.status, "FAILED");
|
|
assert.equal(report.records.length, 1);
|
|
assert.equal(report.records[0].id, "injected-failure");
|
|
assert.equal(report.records[0].exitCode, 17);
|
|
assert.ok(fs.existsSync(`${reportPath}.sha256`));
|
|
process.stdout.write("ci-failure-report-ok status=FAILED exitCode=17 staleReady=false\n");
|
|
}
|
|
finally {
|
|
fs.rmSync(temporary, { recursive: true, force: true });
|
|
}
|
|
|