mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 19:02:17 +03:00
Merged as part of the 39-PR owner batch of 2026-09-11, validated as a unit. Boarded into one consolidated worktree cut from `release/v3.8.51` with the other 38 — zero conflicts between them. - ESLint over every changed file: no errors (the only finding was one suppression entry the batch emptied, pruned on #13243) - `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK - complexity 2821 / baseline 3218 and cognitive-complexity 1272 / baseline 1437 — both under baseline - 256 assertions green: 246 under node:test and 10 under vitest, which is where `tests/unit/**/*.test.tsx` actually runs - `check-file-size`: `chatCore.ts` rebaselined 6144 → 6146 for #13278 and #13276, annotated and landed on #13243 ⚠️ base-red inherited: #12732 — the provider count (356 in the docs vs the 358 the modules define) and `open-sse/utils/stream.ts` at 3115 > frozen 3098 both reproduce on the pure tip with zero contribution from this batch.
60 lines
2.6 KiB
TypeScript
60 lines
2.6 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const REPO_ROOT = path.resolve(import.meta.dirname, "../..");
|
|
|
|
// The optional `cliproxyapi` sidecar (profile `cliproxyapi`) proxies provider
|
|
// credentials (its data volume is `cliproxyapi-data:/root/.cli-proxy-api`) and
|
|
// carried no auth-related environment variable in its `environment:` block.
|
|
// Docker/Podman expand an unqualified "8317:8317" publish spec to 0.0.0.0,
|
|
// which puts this credential-bearing sidecar on every LAN interface the same
|
|
// way a bare "6379:6379" would for Redis (see
|
|
// tests/unit/compose-redis-loopback-bind.test.ts, the precedent this repo
|
|
// already applied). Issue #12578.
|
|
|
|
function readCompose(file: string): string {
|
|
return fs.readFileSync(path.join(REPO_ROOT, file), "utf8");
|
|
}
|
|
|
|
test("docker-compose publishes cliproxyapi on loopback by default", () => {
|
|
const compose = readCompose("docker-compose.yml");
|
|
assert.match(
|
|
compose,
|
|
/- "\$\{CLIPROXY_BIND_HOST:-127\.0\.0\.1\}:\$\{CLIPROXYAPI_PORT:-8317\}:\$\{CLIPROXYAPI_PORT:-8317\}"/,
|
|
"cliproxyapi publish spec must default to 127.0.0.1 (matching the Redis precedent)"
|
|
);
|
|
assert.doesNotMatch(
|
|
compose,
|
|
/- "\$\{CLIPROXYAPI_PORT:-8317\}:\$\{CLIPROXYAPI_PORT:-8317\}"/,
|
|
"unqualified cliproxyapi publish spec binds 0.0.0.0"
|
|
);
|
|
});
|
|
|
|
test("cliproxyapi service forwards a management/auth key into its environment", () => {
|
|
const compose = readCompose("docker-compose.yml");
|
|
const serviceMatch = compose.match(/ {2}cliproxyapi:\n(?:.*\n)*?(?=\n {2}\S|$)/);
|
|
assert.ok(serviceMatch, "cliproxyapi service block must exist in docker-compose.yml");
|
|
assert.match(
|
|
serviceMatch![0],
|
|
/CLIPROXYAPI_MANAGEMENT_KEY/,
|
|
"cliproxyapi environment block must forward CLIPROXYAPI_MANAGEMENT_KEY (already documented in docs/reference/ENVIRONMENT.md) instead of leaving auth entirely to the upstream image's undocumented default"
|
|
);
|
|
});
|
|
|
|
test("qdrant and bifrost sidecars also publish on loopback by default", () => {
|
|
const compose = readCompose("docker-compose.yml");
|
|
assert.match(compose, /- "\$\{QDRANT_BIND_HOST:-127\.0\.0\.1\}:\$\{QDRANT_PORT:-6333\}:6333"/);
|
|
assert.match(
|
|
compose,
|
|
/- "\$\{QDRANT_BIND_HOST:-127\.0\.0\.1\}:\$\{QDRANT_GRPC_PORT:-6334\}:6334"/
|
|
);
|
|
assert.match(compose, /- "\$\{BIFROST_BIND_HOST:-127\.0\.0\.1\}:\$\{BIFROST_PORT:-8080\}:8080"/);
|
|
});
|
|
|
|
test(".env.example documents CLIPROXY_BIND_HOST and its default", () => {
|
|
const env = fs.readFileSync(path.join(REPO_ROOT, ".env.example"), "utf8");
|
|
assert.match(env, /# CLIPROXY_BIND_HOST=127\.0\.0\.1/);
|
|
});
|