mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-02 05:12: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.
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { afterEach, test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import {
|
|
clearBifrostFailure,
|
|
getActiveBifrostCooldown,
|
|
getBifrostFailureCooldownMs,
|
|
recordBifrostFailure,
|
|
resetBifrostCooldowns,
|
|
} from "../../../../src/app/api/v1/relay/chat/completions/bifrostCooldown.ts";
|
|
|
|
afterEach(() => {
|
|
resetBifrostCooldowns();
|
|
});
|
|
|
|
test("bifrost cooldown defaults to a short retry suppression window", () => {
|
|
assert.equal(getBifrostFailureCooldownMs({}), 5000);
|
|
assert.equal(
|
|
getBifrostFailureCooldownMs({ OMNIROUTE_BIFROST_FAILURE_COOLDOWN_MS: "250" }),
|
|
250
|
|
);
|
|
assert.equal(
|
|
getBifrostFailureCooldownMs({ OMNIROUTE_BIFROST_FAILURE_COOLDOWN_MS: "bad" }),
|
|
5000
|
|
);
|
|
});
|
|
|
|
test("bifrost cooldown reports remaining time and expires", () => {
|
|
recordBifrostFailure("http://bifrost.local", "timeout", 1000, 500);
|
|
|
|
assert.deepEqual(getActiveBifrostCooldown("http://bifrost.local", 1100), {
|
|
remainingMs: 400,
|
|
reason: "timeout",
|
|
});
|
|
assert.equal(getActiveBifrostCooldown("http://bifrost.local", 1501), null);
|
|
});
|
|
|
|
test("bifrost cooldown can be disabled or cleared", () => {
|
|
recordBifrostFailure("http://bifrost.local", "timeout", 1000, 0);
|
|
assert.equal(getActiveBifrostCooldown("http://bifrost.local", 1001), null);
|
|
|
|
recordBifrostFailure("http://bifrost.local", "timeout", 1000, 500);
|
|
clearBifrostFailure("http://bifrost.local");
|
|
|
|
assert.equal(getActiveBifrostCooldown("http://bifrost.local", 1001), null);
|
|
});
|