fix(scheduler): читать снимки JSONB и показывать недоступные результаты
This commit is contained in:
1 parent
63b2f75012
commit
92b7399ddb
8 files changed
+102
-9
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { test, expect } from "@playwright/test"
|
||||
const snapshot = { v: 1, job: "backups", sampledAt: "2026-10-01T00:00:00Z", due: true, created: 2, failures: 0, pruned: 1, errors: ["S3 upload unavailable"] }
|
||||
for (const representation of ["jsonb", "legacy", "invalid", "foreign"] as const) test("Сбор данных: snapshot/" + representation, async ({ page }) => {
|
||||
const pageErrors: string[] = []; page.on("pageerror", error => pageErrors.push(error.message))
|
||||
await page.route("**/health", r => r.fulfill({ json: { ok: true } }))
|
||||
await page.route("**/api/**", r => {
|
||||
const path = new URL(r.request().url()).pathname
|
||||
if (path === "/api/traffic/flow/settings") return r.fulfill({ status: 503, json: { error: "NetFlow is outside this snapshot fixture" } })
|
||||
const settings = { enabled: false, intervalSec: 300, retentionDays: 14, lastCollectedAt: null, lastDurationMs: null, lastError: null, scheduler: { jobs: [] } }
|
||||
return r.fulfill({ json: path === "/api/auth/config" ? { required: false } : path === "/api/geoip" ? { settings: { ...settings, updateIntervalSec: 604800 }, countryLoaded: false, asnLoaded: false, dir: "test" } : path === "/api/scheduler/runs" ? { runs: [{ id: "run-jsonb", jobKey: "backups", startedAt: snapshot.sampledAt, finishedAt: snapshot.sampledAt, status: "error", error: "Завершено с ограничениями", durationMs: 100, resultJson: representation === "legacy" ? JSON.stringify(snapshot) : representation === "invalid" ? { ...snapshot, created: undefined } : representation === "foreign" ? { v: 1, job: "traffic", sampledAt: snapshot.sampledAt, servers: [] } : snapshot }] } : settings })
|
||||
})
|
||||
await page.goto("/data-collection")
|
||||
await page.getByRole("button", { name: /Бэкапы.*100 мс/ }).click()
|
||||
await expect(page.getByText("run-jsonb", { exact: true })).toBeVisible()
|
||||
if (representation === "invalid" || representation === "foreign") { await expect(page.getByText("Слот расписания", { exact: true })).toHaveCount(0); await expect(page.getByText("Снимок недоступен", { exact: true })).toBeVisible() }
|
||||
else { await expect(page.getByText("Слот расписания", { exact: true })).toBeVisible(); await expect(page.getByText("S3 upload unavailable", { exact: true })).toBeVisible(); await expect(page.getByText("Создано", { exact: true }).locator("..")).toContainText("2") }
|
||||
expect(pageErrors).toEqual([])
|
||||
})
|
||||
Reference in new issue
Block a user