mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 03:10:38 +09:00
fix: harden heartbeat and adapter runtime workflows
This commit is contained in:
parent
548721248e
commit
c566a9236c
48 changed files with 14922 additions and 600 deletions
|
|
@ -76,6 +76,21 @@ describe("TelemetryClient periodic flush", () => {
|
|||
expect(fetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("falls back to the api gateway ingest url when the default hostname fails", async () => {
|
||||
vi.mocked(fetch)
|
||||
.mockRejectedValueOnce(new TypeError("getaddrinfo ENOTFOUND telemetry.paperclip.ing"))
|
||||
.mockResolvedValueOnce({ ok: true });
|
||||
|
||||
const client = makeClient({ endpoint: undefined });
|
||||
client.track("install.started");
|
||||
|
||||
await client.flush();
|
||||
|
||||
expect(fetch).toHaveBeenCalledTimes(2);
|
||||
expect(vi.mocked(fetch).mock.calls[0]?.[0]).toBe("https://telemetry.paperclip.ing/ingest");
|
||||
expect(vi.mocked(fetch).mock.calls[1]?.[0]).toBe("https://rusqrrg391.execute-api.us-east-1.amazonaws.com/ingest");
|
||||
});
|
||||
|
||||
it("startPeriodicFlush is idempotent", () => {
|
||||
const client = makeClient();
|
||||
client.startPeriodicFlush(1000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue