mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-05 23:02:10 +03:00
This commit is contained in:
committed by
GitHub
parent
29bb59e18d
commit
6bb3207912
@@ -4,6 +4,7 @@ import { readFileSync } from "node:fs";
|
||||
import {
|
||||
getBifrostRoutingConfig,
|
||||
getRoutingFallbackHeader,
|
||||
getRoutingFallbackReasonHeader,
|
||||
resolveRelayRoutingBackend,
|
||||
shouldTryBifrost,
|
||||
shouldTryBifrostForRequest,
|
||||
@@ -176,3 +177,29 @@ test("automatic relay keeps the Bifrost timeout active until an SSE stream final
|
||||
assert.match(streamBranch, /error && backend === "auto"/);
|
||||
assert.match(streamBranch, /recordBifrostFailure\(/);
|
||||
});
|
||||
|
||||
test("relay routing fallback reason header strips dynamic cooldown detail to the stable code", () => {
|
||||
assert.equal(
|
||||
getRoutingFallbackReasonHeader("bifrost-cooldown; remaining=1500"),
|
||||
"bifrost-cooldown"
|
||||
);
|
||||
});
|
||||
|
||||
test("relay routing fallback reason header passes already-stable reasons through unchanged", () => {
|
||||
assert.equal(getRoutingFallbackReasonHeader("bifrost-error"), "bifrost-error");
|
||||
assert.equal(getRoutingFallbackReasonHeader("bifrost-ineligible"), "bifrost-ineligible");
|
||||
assert.equal(
|
||||
getRoutingFallbackReasonHeader("bifrost-provider-unknown"),
|
||||
"bifrost-provider-unknown"
|
||||
);
|
||||
});
|
||||
|
||||
test("relay routing fallback reason header stays unset for the bare static legacy value", () => {
|
||||
assert.equal(getRoutingFallbackReasonHeader("bifrost"), undefined);
|
||||
});
|
||||
|
||||
test("relay routing fallback reason header stays unset for null/undefined/unrecognized input", () => {
|
||||
assert.equal(getRoutingFallbackReasonHeader(null), undefined);
|
||||
assert.equal(getRoutingFallbackReasonHeader(undefined), undefined);
|
||||
assert.equal(getRoutingFallbackReasonHeader("something-unrecognized"), undefined);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user