refactor: split renderer ipc and unraid domains
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { createRequire } from "node:module";
|
||||
import { readFile } from "node:fs/promises";
|
||||
const require = createRequire(import.meta.url);
|
||||
const {
|
||||
UnraidDeploymentService,
|
||||
@@ -18,6 +19,11 @@ const {
|
||||
const { fingerprintKey, shellQuote } = require("../src/main/ssh-service.cjs");
|
||||
const { buildWorkloadInventory, deploymentRootCandidate } = require("../src/main/server-inventory.cjs");
|
||||
|
||||
async function unraidSource() {
|
||||
const files = ["unraid-deployment-service.cjs", "unraid-access-methods.cjs", "unraid-preflight-methods.cjs", "unraid-runtime-methods.cjs", "unraid-deployment-methods.cjs", "unraid-inventory-methods.cjs"];
|
||||
return (await Promise.all(files.map((file) => readFile(new URL(`../src/main/${file}`, import.meta.url), "utf8")))).join("\n");
|
||||
}
|
||||
|
||||
test("Unraid remote paths cannot escape appdata project folder", () => {
|
||||
assert.equal(safeRemoteFolder("lumaops"), "lumaops");
|
||||
assert.throws(() => safeRemoteFolder("../lumaops"));
|
||||
@@ -656,15 +662,10 @@ test("SSH deployment dispatch returns a running operation while the remote build
|
||||
});
|
||||
|
||||
test("Unraid preflight verifies repository access before a deployment can start", async () => {
|
||||
const source = await import("node:fs/promises").then(({ readFile }) =>
|
||||
readFile(
|
||||
new URL("../src/main/unraid-deployment-service.cjs", import.meta.url),
|
||||
"utf8",
|
||||
),
|
||||
);
|
||||
const source = await unraidSource();
|
||||
assert.match(source, /server-git-access/);
|
||||
assert.match(source, /git ls-remote --exit-code/);
|
||||
assert.match(source, /Unraid → Gitea read access/);
|
||||
assert.match(source, /Unraid .* Gitea read access/);
|
||||
});
|
||||
|
||||
test("DockerMan metadata uses dockerman labels, a template WebUI and lowercase-safe service/image names", () => {
|
||||
@@ -855,12 +856,7 @@ test("stuck SSH deployment is reconciled to success when exact SHA and container
|
||||
});
|
||||
|
||||
test("DockerMan metadata repair refreshes known Unraid icon caches after container recreation", async () => {
|
||||
const source = await import("node:fs/promises").then(({ readFile }) =>
|
||||
readFile(
|
||||
new URL("../src/main/unraid-deployment-service.cjs", import.meta.url),
|
||||
"utf8",
|
||||
),
|
||||
);
|
||||
const source = await unraidSource();
|
||||
assert.match(source, /\/var\/lib\/docker\/unraid\/images/);
|
||||
assert.match(source, /dynamix\.docker\.manager\/images/);
|
||||
assert.match(source, /-icon\.png/);
|
||||
|
||||
Reference in New Issue
Block a user