Sync public tree to c852e65
This commit is contained in:
parent
4e04601794
commit
e2bc145f60
4 changed files with 223 additions and 7 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -430,7 +430,12 @@ expect(
|
|||
expect(
|
||||
cli,
|
||||
"CLI applies process exit code after printing command failure report",
|
||||
/fn emit_report<T: Serialize>[\s\S]*apply_command_report_exit_code[\s\S]*std::process::exit\(exit_code\)/
|
||||
/fn emit_report<T: Serialize>[\s\S]*apply_command_report_exit_code[\s\S]*std::process::exit\(exit_code\)[\s\S]*fn human_report/
|
||||
);
|
||||
expect(
|
||||
cli,
|
||||
"CLI applies artifact nested failure exit codes",
|
||||
/fn apply_command_report_exit_code[\s\S]*"\/download_session\/machine_error"[\s\S]*"\/export_plan\/machine_error"[\s\S]*"\/local_export\/machine_error"[\s\S]*"\/local_export\/download_session\/machine_error"[\s\S]*"\/local_export\/stream\/machine_error"/
|
||||
);
|
||||
expect(
|
||||
cli,
|
||||
|
|
@ -541,6 +546,8 @@ for (const [name, pattern] of [
|
|||
["actual quota resource-category assertion", /machine_error\.resource_category, "api_calls"/],
|
||||
["actual quota community-tier label assertion", /machine_error\.community_tier_label,[\s\S]*"community tier"/],
|
||||
["actual quota abuse-heuristics assertion", /machine_error\.private_abuse_heuristics_exposed,[\s\S]*false/],
|
||||
["artifact download rejection exit code", /artifactDownload[\s\S]*assert\.strictEqual\(artifactDownload\.result\.code, 21/],
|
||||
["artifact export rejection exit code", /artifactExport[\s\S]*assert\.strictEqual\(artifactExport\.result\.code, 25/],
|
||||
["exit-code application in JSON", /process_exit_code_applied[\s\S]*true/],
|
||||
]) {
|
||||
expect(errorExitSmoke, name, pattern);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue