Skip to content

Commit 2ef2c30

Browse files
committed
test(cli): assert failed inference set preserves state
1 parent 5b0217d commit 2ef2c30

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

test/inference-set-config-read-exit.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe("inference set sandbox configuration read failures", () => {
1616
let home: string;
1717
let openshell: string;
1818
let openshellLog: string;
19+
let registryFile: string;
1920

2021
beforeEach(() => {
2122
home = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-9104-"));
@@ -34,8 +35,9 @@ describe("inference set sandbox configuration read failures", () => {
3435

3536
const registryDir = path.join(home, ".nemoclaw");
3637
fs.mkdirSync(registryDir, { recursive: true });
38+
registryFile = path.join(registryDir, "sandboxes.json");
3739
fs.writeFileSync(
38-
path.join(registryDir, "sandboxes.json"),
40+
registryFile,
3941
JSON.stringify({
4042
sandboxes: {
4143
[SANDBOX]: {
@@ -89,6 +91,7 @@ describe("inference set sandbox configuration read failures", () => {
8991
"%s inference set exits with status 1 when OpenShell cannot read the sandbox configuration (#9104)",
9092
testTimeoutOptions(30_000),
9193
(_grammar, argv) => {
94+
const registryBefore = fs.readFileSync(registryFile, "utf8");
9295
const result = spawnSync(process.execPath, [CLI, ...argv], {
9396
encoding: "utf8",
9497
env: {
@@ -106,6 +109,8 @@ describe("inference set sandbox configuration read failures", () => {
106109
expect(result.error).toBeUndefined();
107110
expect(result.signal).toBeNull();
108111
expect(output).toContain("Cannot read openclaw config (/sandbox/.openclaw/openclaw.json)");
112+
expect(output).not.toContain("Setting OpenShell inference route");
113+
expect(fs.readFileSync(registryFile, "utf8")).toBe(registryBefore);
109114
const openshellCalls = fs.readFileSync(openshellLog, "utf8").trim().split("\n");
110115
expect(openshellCalls).toHaveLength(1);
111116
expect(openshellCalls[0]).toContain("sandbox exec");

0 commit comments

Comments
 (0)