Merge ingest-api, collector-worker, admin-ui, database/error_reporting, deploy/lxc, docker-compose, and deployment docs into the dedicated repository. Paths updated for repo root (ER_REPO_ROOT, systemd WorkingDirectory). Root README documents layout. Co-Authored-By: Paperclip <[email protected]>
35 lines
801 B
TypeScript
35 lines
801 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { computeBackoffDelayMs } from "./sourceState.js";
|
|
|
|
describe("computeBackoffDelayMs", () => {
|
|
it("returns base when no failures", () => {
|
|
expect(
|
|
computeBackoffDelayMs({
|
|
baseIntervalMs: 30_000,
|
|
consecutiveFailures: 0,
|
|
maxBackoffExponent: 8,
|
|
}),
|
|
).toBe(30_000);
|
|
});
|
|
|
|
it("doubles per failure up to cap", () => {
|
|
expect(
|
|
computeBackoffDelayMs({
|
|
baseIntervalMs: 10_000,
|
|
consecutiveFailures: 2,
|
|
maxBackoffExponent: 8,
|
|
}),
|
|
).toBe(40_000);
|
|
});
|
|
|
|
it("respects max exponent", () => {
|
|
expect(
|
|
computeBackoffDelayMs({
|
|
baseIntervalMs: 1000,
|
|
consecutiveFailures: 100,
|
|
maxBackoffExponent: 3,
|
|
}),
|
|
).toBe(8000);
|
|
});
|
|
});
|