Sync public tree to c852e65

This commit is contained in:
Michel Paulissen 2026-07-04 12:53:18 +02:00
parent 4e04601794
commit e2bc145f60
4 changed files with 223 additions and 7 deletions

View file

@ -34,6 +34,27 @@ function runDisasmer(args) {
});
}
async function runWithOneCoordinatorResponse(buildArgs, response) {
let request = "";
const server = net.createServer((socket) => {
socket.setEncoding("utf8");
socket.on("data", (chunk) => {
request += chunk;
if (!request.includes("\n")) return;
socket.write(JSON.stringify(response) + "\n");
socket.end();
server.close();
});
});
const address = await new Promise((resolve) => {
server.listen(0, "127.0.0.1", () => resolve(server.address()));
});
const coordinator = `http://${address.address}:${address.port}`;
const result = await runDisasmer(buildArgs(coordinator));
return { request, result };
}
async function main() {
const nonInteractive = await runDisasmer([
"run",
@ -120,6 +141,62 @@ async function main() {
report.run_start.machine_error.next_actions.includes("disasmer quota status")
);
const artifactDownload = await runWithOneCoordinatorResponse(
(coordinator) => [
"artifact",
"download",
"app.txt",
"--coordinator",
coordinator,
"--json",
],
{
type: "artifact_download_denied",
message: "artifact download unauthorized for project",
}
);
assert.strictEqual(artifactDownload.result.signal, null, artifactDownload.result.stderr);
assert.strictEqual(artifactDownload.result.code, 21, artifactDownload.result.stderr);
assert.match(artifactDownload.request, /"type":"create_artifact_download_link"/);
const artifactDownloadReport = JSON.parse(artifactDownload.result.stdout);
assert.strictEqual(
artifactDownloadReport.download_session.machine_error.category,
"authorization"
);
assert.strictEqual(
artifactDownloadReport.download_session.machine_error.process_exit_code_applied,
true
);
const artifactExport = await runWithOneCoordinatorResponse(
(coordinator) => [
"artifact",
"export",
"app.txt",
"--to",
path.join(project, "target", "blocked-artifact.txt"),
"--coordinator",
coordinator,
"--json",
],
{
type: "artifact_export_unavailable",
message: "direct connectivity unavailable for artifact export",
}
);
assert.strictEqual(artifactExport.result.signal, null, artifactExport.result.stderr);
assert.strictEqual(artifactExport.result.code, 25, artifactExport.result.stderr);
assert.match(artifactExport.request, /"type":"export_artifact_to_node"/);
const artifactExportReport = JSON.parse(artifactExport.result.stdout);
assert.strictEqual(
artifactExportReport.export_plan.machine_error.category,
"connectivity"
);
assert.strictEqual(
artifactExportReport.export_plan.machine_error.process_exit_code_applied,
true
);
const confirmation = await runDisasmer([
"process",
"cancel",