mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
fix(status): expose background failures
This commit is contained in:
1 parent
a689329e79
commit
8ece6f39cc
31 files changed
+854
-44
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { I18nProvider } from "@/lib/i18n/context";
|
||||
import { FailingJobsCard } from "../system-status-section";
|
||||
|
||||
function render(node: React.ReactNode) {
|
||||
return renderToStaticMarkup(
|
||||
<I18nProvider initialLocale="en">{node}</I18nProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
describe("FailingJobsCard", () => {
|
||||
it("renders named exhausted-retry failures from failingJobs", () => {
|
||||
const html = render(
|
||||
<FailingJobsCard
|
||||
failingJobs={{
|
||||
windowHours: 72,
|
||||
queues: [
|
||||
{
|
||||
queue: "environment-fetch",
|
||||
failures: 2,
|
||||
lastFailedAt: "2026-07-28T12:00:00.000Z",
|
||||
lastError: "upstream unavailable",
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(html).toContain("environment-fetch");
|
||||
expect(html).toContain("2 failures");
|
||||
expect(html).toContain("upstream unavailable");
|
||||
expect(html).toContain('data-testid="failing-jobs-list"');
|
||||
});
|
||||
|
||||
it("distinguishes an unavailable queue ledger from an empty one", () => {
|
||||
const unavailable = render(<FailingJobsCard failingJobs={null} />);
|
||||
const empty = render(
|
||||
<FailingJobsCard failingJobs={{ windowHours: 72, queues: [] }} />,
|
||||
);
|
||||
|
||||
expect(unavailable).toContain("No job queue to read");
|
||||
expect(unavailable).not.toContain('data-testid="failing-jobs-none"');
|
||||
expect(empty).toContain('data-testid="failing-jobs-none"');
|
||||
expect(empty).toContain("No job has failed in the last 72 hours.");
|
||||
});
|
||||
});
|
||||
@@ -42,7 +42,6 @@ export interface WorkerStatus {
|
||||
lastWithingsSync: string | null;
|
||||
lastInsightsRun: string | null;
|
||||
jobsProcessed: number;
|
||||
errors: number;
|
||||
}
|
||||
|
||||
/** One queue with exhausted-retry failures, as `/api/admin/status` reports it. */
|
||||
|
||||
@@ -59,7 +59,7 @@ const HostMetricsChart = dynamic(
|
||||
* means quiet queues, which is why the "cannot ask" case renders its own line
|
||||
* rather than looking identical to health.
|
||||
*/
|
||||
function FailingJobsCard({
|
||||
export function FailingJobsCard({
|
||||
failingJobs,
|
||||
}: {
|
||||
failingJobs: { windowHours: number; queues: FailingQueue[] } | null;
|
||||
|
||||
Reference in new issue
Block a user