Inject the incus command, so the enumeration tests fail incus on every machine

The tests set MESH_LAB_INCUS in their body, which runs after the client module has read it, so they
asked the real incus: green where none is installed, red on the workstation that runs the lab.
This commit is contained in:
jochen
2026-10-08 10:15:59 +02:00
parent 505db85539
commit 179f73c18f
2 changed files with 27 additions and 7 deletions
+9 -6
View File
@@ -1,11 +1,14 @@
// Set before importing: the client reads MESH_LAB_INCUS once, at module load.
// `false` is a real program that exits non-zero and prints nothing — which is also the worst
// case, because an empty stderr is how a failure arrives with no explanation.
process.env["MESH_LAB_INCUS"] = "false";
import { test } from "node:test";
import assert from "node:assert/strict";
import { instanceExists, taggedInstances, taggedNetworks } from "../src/incus/client.ts";
import { instanceExists, taggedInstances, taggedNetworks, useIncusCommand } from "../src/incus/client.ts";
// `false` is a real program that exits non-zero and prints nothing — which is also the worst
// case, because an empty stderr is how a failure arrives with no explanation.
//
// **Injected, never set in the environment here.** This file used to set MESH_LAB_INCUS in its body,
// which runs after the imports above — so the client had already read the variable, and these tests
// asked the real incus: green on a machine without one, red on the workstation that runs the lab.
useIncusCommand(["false"]);
/**
* "I cannot see" must never be answered as "there is nothing there."