mirror of
https://github.com/morluto/rea.git
synced 2026-11-21 14:05:49 +00:00
test(config): consolidate Rizin session capacity coverage (#12780)
This commit is contained in:
1 parent
db0171297d
commit
29049fcfd9
1 file changed
+15
-39
@@ -1,5 +1,8 @@
|
||||
import { join } from "node:path";
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../tests/fixtures/temporaryDirectory.js";
|
||||
|
||||
import { ConfigurationError } from "../domain/configurationErrors.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import {
|
||||
@@ -184,41 +187,6 @@ it("applies runtime debugger overrides before rejecting invalid launch values",
|
||||
expect(sessions.ok).toBe(false);
|
||||
});
|
||||
|
||||
it("names the session setting on a Rizin capacity refusal", async () => {
|
||||
const manager = new RizinDebugSessionManager(
|
||||
{ [DEBUGGER_MAX_SESSIONS_SETTING]: "1" },
|
||||
{ platform: "linux" },
|
||||
);
|
||||
const first = manager.start({
|
||||
path: "/tmp/rea-debugger-limit",
|
||||
inferior_tty: "/no/such/rea-debugger-tty",
|
||||
});
|
||||
const blocked = await manager.start({
|
||||
path: "/tmp/rea-debugger-limit-2",
|
||||
inferior_tty: "/no/such/rea-debugger-tty",
|
||||
});
|
||||
if (blocked.ok) throw new Error("expected the session cap to refuse");
|
||||
expect(projectAnalysisError(blocked.error)).toMatchObject({
|
||||
code: "resource_constraint",
|
||||
details: {
|
||||
resource: "memory",
|
||||
reported_limits: {
|
||||
setting: DEBUGGER_MAX_SESSIONS_SETTING,
|
||||
effective_value: 1,
|
||||
source: "setting",
|
||||
minimum: MINIMUM_DEBUGGER_MAX_SESSIONS,
|
||||
maximum: MAXIMUM_DEBUGGER_MAX_SESSIONS,
|
||||
unit: "sessions",
|
||||
update_mode: "restart",
|
||||
pending_restart: false,
|
||||
max_sessions: 1,
|
||||
active_or_reserved_sessions: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
await first;
|
||||
});
|
||||
|
||||
it("keeps the command-output maximum inside one Evidence hash string", () => {
|
||||
const escaped = JSON.stringify("\u0001");
|
||||
const expansion = escaped.length - 2;
|
||||
@@ -236,7 +204,8 @@ it("keeps the command-output maximum inside one Evidence hash string", () => {
|
||||
).toBeLessThanOrEqual(nodeMaxStringLength);
|
||||
});
|
||||
|
||||
it("does not let one Rizin manager consume another manager's session cap", async () => {
|
||||
it("enforces each Rizin manager's cap and reports which setting refused a start", async () => {
|
||||
const root = await createTestTempDirectory("rea-rizin-capacity-");
|
||||
const first = new RizinDebugSessionManager(
|
||||
{ [DEBUGGER_MAX_SESSIONS_SETTING]: "1" },
|
||||
{ platform: "linux" },
|
||||
@@ -246,14 +215,14 @@ it("does not let one Rizin manager consume another manager's session cap", async
|
||||
{ platform: "linux" },
|
||||
);
|
||||
const input = {
|
||||
path: "/tmp/rea-debugger-limit",
|
||||
inferior_tty: "/no/such/rea-debugger-tty",
|
||||
path: join(root, "selected"),
|
||||
inferior_tty: join(root, "missing-tty"),
|
||||
};
|
||||
const held = first.start(input);
|
||||
const independent = second.start(input);
|
||||
const blocked = first.start({
|
||||
...input,
|
||||
path: "/tmp/rea-debugger-limit-2",
|
||||
path: join(root, "another-target"),
|
||||
});
|
||||
try {
|
||||
const independentResult = await independent;
|
||||
@@ -271,10 +240,17 @@ it("does not let one Rizin manager consume another manager's session cap", async
|
||||
expect(projectAnalysisError(blockedResult.error)).toMatchObject({
|
||||
code: "resource_constraint",
|
||||
details: {
|
||||
resource: "memory",
|
||||
reported_limits: {
|
||||
setting: DEBUGGER_MAX_SESSIONS_SETTING,
|
||||
effective_value: 1,
|
||||
source: "setting",
|
||||
minimum: MINIMUM_DEBUGGER_MAX_SESSIONS,
|
||||
maximum: MAXIMUM_DEBUGGER_MAX_SESSIONS,
|
||||
unit: "sessions",
|
||||
update_mode: "restart",
|
||||
pending_restart: false,
|
||||
max_sessions: 1,
|
||||
active_or_reserved_sessions: 1,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user