mesh/check failed: unit: modules/gitea.test: [gitea] where the poll of merges last looked from could not be read, so none is kept — no runtime | 49a28…
mesh/delivery superseded: a newer head of the same pull request
mesh/merge-gate head 49a28f85378b merged into trunk c770f7947d95 — pass: builds gitea → novox; no bus step; every machine composes with the change as it di…
mesh/repo-check head 49a28f85378b merged into trunk c770f7947d95 — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-…
59 lines
2.6 KiB
TypeScript
59 lines
2.6 KiB
TypeScript
// **A consumer that cannot be bound yet is bound again** (novox/hq issue 1793): the runtime's "no responders" at the
|
|
// bundle's start, seen 2026-10-22 00:28:37 on mesh-catalog#427's verdict, ended the bundle and the verdict was never
|
|
// written on the forge.
|
|
|
|
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { bindInBackground, bindUntilHeld, bindWait } from "../dist/bind.js";
|
|
|
|
test("a bind refused with no responders is asked again until it holds, and says so", async () => {
|
|
let calls = 0;
|
|
const waits: number[] = [];
|
|
const said: string[] = [];
|
|
await bindUntilHeld("mesh-controller.checked", async () => {
|
|
calls++;
|
|
if (calls < 4) throw new Error("binding gitea's consumer novox_gitea: nats: no responders available for request");
|
|
}, async (ms) => { waits.push(ms); }, (l) => said.push(l));
|
|
assert.equal(calls, 4);
|
|
assert.deepEqual(waits, [2_000, 5_000, 10_000]);
|
|
assert.equal(said.length, 4);
|
|
assert.match(said[0], /no responders available for request.*asking again in 2s/);
|
|
assert.match(said[3], /is bound after 4 attempts/);
|
|
});
|
|
|
|
test("a bind that holds the first time says nothing and waits for nothing", async () => {
|
|
const said: string[] = [];
|
|
await bindUntilHeld("x", async () => {}, async () => assert.fail("waited"), (l) => said.push(l));
|
|
assert.deepEqual(said, []);
|
|
});
|
|
|
|
test("the wait grows to 30 s and stays", () => {
|
|
assert.deepEqual([1, 2, 3, 4, 50].map(bindWait), [2_000, 5_000, 10_000, 30_000, 30_000]);
|
|
});
|
|
|
|
test("the binds start without being waited for: the caller returns while a bind keeps refusing, and they go in order", async () => {
|
|
const order: string[] = [];
|
|
let finished = false;
|
|
let refusals = 0;
|
|
const gate = new Promise<void>((r) => setTimeout(r, 0));
|
|
bindInBackground([
|
|
["first", async () => { refusals++; if (refusals < 3) throw new Error("nats: no responders available for request"); order.push("first"); }],
|
|
["second", async () => { order.push("second"); }],
|
|
], () => { finished = true; }, async () => { await gate; }, () => {});
|
|
// Returned at once, with the first bind refused and nothing done.
|
|
assert.equal(finished, false);
|
|
assert.deepEqual(order, []);
|
|
await new Promise((r) => setTimeout(r, 20));
|
|
assert.deepEqual(order, ["first", "second"]);
|
|
assert.equal(finished, true);
|
|
});
|
|
|
|
test("a bind that never holds does not stop the caller from returning", () => {
|
|
let returned = false;
|
|
bindInBackground([["x", async () => { throw new Error("no responders"); }]], () => assert.fail("done"),
|
|
() => new Promise(() => {}), () => {});
|
|
returned = true;
|
|
assert.equal(returned, true);
|
|
});
|