mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
fix(process): classify every launcher failure once by errno in the shared launch owner (#11615)
* fix(process): classify every launcher failure once by errno in the shared launch owner * fix(process): keep the launch owner's syscall, cause and facts in RE and pwntools unavailable reports
This commit is contained in:
1 parent
0884836abf
commit
dbb4bc29f0
29 files changed
+712
-289
No files matched your search
@@ -1,6 +1,13 @@
|
||||
import { SqliteDatabaseProvider } from "../../../src/sqlite/SqliteDatabaseProvider.js";
|
||||
import { createSqliteDatabaseFixture } from "../../fixtures/sqlite/database.js";
|
||||
import { spawnFailure } from "../../support/process/spawnFailure.js";
|
||||
import {
|
||||
createTestWorkspace,
|
||||
removeTestWorkspace,
|
||||
} from "../../support/workspace/workspaceFixture.js";
|
||||
import { ArtifactReaderFailure } from "../../../src/resources/ArtifactReader.js";
|
||||
import { classifyProviderFailure } from "../../../src/providers/classifyProviderFailure.js";
|
||||
import { expect, it } from "vitest";
|
||||
import { expect, it, onTestFinished } from "vitest";
|
||||
import { OwnedCommandFailure } from "../../../src/process/OwnedCommand.js";
|
||||
import { projectAnalysisError } from "../../../src/domain/analysisErrorProjection.js";
|
||||
import { sqliteDatabaseDialect } from "../../../src/sqlite/SqliteDatabaseFailures.js";
|
||||
@@ -179,3 +186,38 @@ it("does not infer cancellation from a later signal when cleanup carries no canc
|
||||
details: { resources: ["/owned/reply.json"] },
|
||||
});
|
||||
});
|
||||
|
||||
// A worker launch failure reaches the shared launch owner even though the
|
||||
// SQLite dialect describes no command reports.
|
||||
it.each([
|
||||
["EAGAIN", "resource_constraint", { resource: "capacity" }],
|
||||
["E2BIG", "resource_constraint", { resource: "transport" }],
|
||||
["EIO", "capability_unavailable", { provider_id: "sqlite" }],
|
||||
] as const)(
|
||||
"classifies a SQLite worker launch failure %s once by errno",
|
||||
async (code, projectedCode, details) => {
|
||||
const workspace = await createTestWorkspace("rea-sqlite-launch-");
|
||||
onTestFinished(() => removeTestWorkspace(workspace.root));
|
||||
const database = createSqliteDatabaseFixture(workspace.root);
|
||||
database.close();
|
||||
const provider = new SqliteDatabaseProvider({}, async (input) => {
|
||||
throw spawnFailure(code, input.command);
|
||||
});
|
||||
onTestFinished(() => provider.close());
|
||||
const result = await provider.inspect({ path: database.path });
|
||||
if (result.ok) throw new Error("Expected the worker launch to fail");
|
||||
const projected = projectAnalysisError(result.error);
|
||||
expect(projected).toMatchObject({
|
||||
code: projectedCode,
|
||||
details: {
|
||||
...details,
|
||||
diagnostics: {
|
||||
system_code: code,
|
||||
syscall: `spawn ${process.execPath}`,
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(projected.message).toContain(code);
|
||||
expect((await provider.inspect({ path: database.path })).ok).toBe(false);
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user