mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-06 23:32:12 +03:00
Validated in local merge-train (devbox-vm-06-dev002) @ combined-tip (FAST gates green: static + changed tests + vitest — only pre-existing audit.test.ts flake). Evidence: /home/diegosouzapw/dev/proxys/OmniRoute/.claude/worktrees/merge-train-20260805-213228-suite.log
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { describe, it } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { runWithProxyContext } from "../../open-sse/utils/proxyFetch.ts";
|
|
import { proxyConfigToUrl } from "../../open-sse/utils/proxyDispatcher.ts";
|
|
import {
|
|
invalidateProxyHealth,
|
|
__setProxyHealthTcpCheckForTesting,
|
|
} from "../../src/lib/proxyHealth.ts";
|
|
|
|
describe("runWithProxyContext nested same-context skip (#9158)", () => {
|
|
it("skips the reachability probe for a nested same-config call", async () => {
|
|
const cfg = { type: "http" as const, host: "127.0.0.1", port: 8080 };
|
|
const proxyUrl = proxyConfigToUrl(cfg)!;
|
|
assert.ok(proxyUrl);
|
|
|
|
let probeCount = 0;
|
|
__setProxyHealthTcpCheckForTesting(async () => {
|
|
probeCount += 1;
|
|
return true;
|
|
});
|
|
try {
|
|
const result = await runWithProxyContext(cfg, () => {
|
|
invalidateProxyHealth(proxyUrl);
|
|
return runWithProxyContext(cfg, () => "nested-marker");
|
|
});
|
|
assert.equal(result, "nested-marker");
|
|
assert.equal(probeCount, 1, "nested same-context call must skip the reachability probe");
|
|
} finally {
|
|
__setProxyHealthTcpCheckForTesting(null);
|
|
invalidateProxyHealth(proxyUrl);
|
|
}
|
|
});
|
|
});
|