mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
Release v3.8.42 — full CHANGELOG in CHANGELOG.md. CI: 103 checks green incl. CodeQL (all languages), Semgrep, all 8 unit shards, coverage, Node 24 compat, and integration tests. Full unit suite validated locally: 19437 pass / 0 fail. The 3 red checks are advisory and do not gate main (no required status checks): SonarCloud/SonarQube new-code coverage gate, and PR Test Policy (test-masking detector flagging the legitimate dead-Phind provider removal in #5530 — reviewed, correct). Includes cycle-close reconciliation + repair of inherited base-red tests from #5480/#5527/#5427/#5521 that the PR->release fast-path did not exercise.
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
|
|
import {
|
|
REDIS_CONTAINER_NAME,
|
|
detectRedisContainerRuntime,
|
|
redisRuntimeUnavailableResponse,
|
|
runRedisRuntimeCommand,
|
|
} from "../../src/app/api/local/redis/redisRuntime.ts";
|
|
|
|
test("detectRedisContainerRuntime returns the first available runtime", async () => {
|
|
const calls: string[] = [];
|
|
const runtime = await detectRedisContainerRuntime(async (file) => {
|
|
calls.push(file);
|
|
if (file === "podman") {
|
|
throw new Error("missing");
|
|
}
|
|
return { stdout: "Docker version 1\n", stderr: "" };
|
|
});
|
|
|
|
assert.equal(runtime, "docker");
|
|
assert.deepEqual(calls, ["podman", "docker"]);
|
|
});
|
|
|
|
test("detectRedisContainerRuntime returns null when no runtime is available", async () => {
|
|
const runtime = await detectRedisContainerRuntime(async () => {
|
|
throw new Error("missing");
|
|
});
|
|
|
|
assert.equal(runtime, null);
|
|
});
|
|
|
|
test("runRedisRuntimeCommand trims command output", async () => {
|
|
const result = await runRedisRuntimeCommand(
|
|
"docker",
|
|
["stop", REDIS_CONTAINER_NAME],
|
|
15_000,
|
|
async () => ({
|
|
stdout: " stopped \n",
|
|
stderr: " warning \n",
|
|
})
|
|
);
|
|
|
|
assert.deepEqual(result, { stdout: "stopped", stderr: "warning" });
|
|
});
|
|
|
|
test("redisRuntimeUnavailableResponse preserves the route error shape", async () => {
|
|
const response = redisRuntimeUnavailableResponse();
|
|
|
|
assert.equal(response.status, 503);
|
|
assert.deepEqual(await response.json(), {
|
|
ok: false,
|
|
error: "No container runtime (podman or docker) found on PATH",
|
|
});
|
|
});
|