refactor web pagination and add partitioned events, flap/timeout showcase agents

This commit is contained in:
Stanislav Rossovskii
2026-05-27 18:23:31 +04:00
parent d5f312f200
commit a2e88b4e76
46 changed files with 1600 additions and 742 deletions

View File

@@ -55,6 +55,24 @@ const fixtures = {
incident_key: "agent-1:load",
summary: "load high",
},
{
agent_id: "agent-1",
check_id: "agent_liveness",
status: "ok",
exit_code: 0,
last_observed_at: now,
incident_key: "agent:agent-1:liveness",
summary: "agent is alive",
},
{
agent_id: "agent-2",
check_id: "agent_liveness",
status: "critical",
exit_code: 2,
last_observed_at: now,
incident_key: "agent:agent-2:liveness",
summary: "agent is dead",
},
],
next_cursor: null,
},
@@ -122,6 +140,19 @@ const fixtures = {
output_truncated: false,
notifications_enabled: true,
},
{
event_id: "00000000-0000-7000-8000-000000000003",
agent_id: "agent-2",
check_id: "agent_liveness",
observed_at: now,
received_at: now,
status: "critical",
exit_code: 2,
duration_ms: 0,
output: "agent is dead",
output_truncated: false,
notifications_enabled: true,
},
],
next_cursor: null,
},

View File

@@ -17,7 +17,7 @@ test("agents list links to detail", async ({ page }) => {
await expect(page.locator("thead")).not.toContainText("asc");
await expect(page.locator("thead")).not.toContainText("desc");
await expect(page.locator("thead")).toContainText("↓");
await expect(page.locator("body")).toContainText("checks 2");
await expect(page.locator("body")).toContainText("checks 3");
await expect(page.locator("body")).toContainText("warn 1");
await expect(page.getByRole("button", { name: /Timezone: default/ })).toBeVisible();
await page.getByRole("button", { name: /Timezone: default/ }).click();
@@ -73,7 +73,7 @@ test("checks page lists rows", async ({ page }) => {
await expect(page.locator("body")).toContainText("host-1");
await expect(page.locator("body")).toContainText("disk ok");
await page.getByRole("link", { name: "Events" }).last().click();
await expect(page).toHaveURL(/\/checks\/disk\?tab=events$/);
await expect(page).toHaveURL(/\/checks\/disk\?tab=events(?:&events_limit=\d+)?$/);
await expect(page.locator("body")).toContainText("12");
await expect(page.locator("thead").last()).not.toContainText("exit");
});
@@ -83,7 +83,6 @@ test("incidents filter renders", async ({ page }) => {
await expect(page.locator("body")).toContainText("load high");
await expect(page.locator("thead")).toContainText("HOST");
await expect(page.locator("thead")).not.toContainText("agent_id");
await expect(page.locator("thead")).toContainText("↓");
await expect(page.locator("tbody")).toContainText("host-1");
await expect(page.locator("tbody")).toContainText("agent_liveness");
await expect(page.locator("tbody")).toContainText("agent is dead");
@@ -91,10 +90,7 @@ test("incidents filter renders", async ({ page }) => {
await expect(page).toHaveURL(/\/checks\/agent_liveness$/);
await expect(page.locator("body")).toContainText("host-2");
await page.goto("/incidents");
await page.getByRole("button", { name: /^HOST/ }).click();
await expect(page).toHaveURL(/\/incidents$/);
await expect(page.locator("thead")).toContainText("↑");
await page.getByRole("link", { name: "host-1" }).click();
await page.getByRole("link", { name: "host-1" }).first().click();
await expect(page).toHaveURL(/\/agents\/agent-1$/);
});