fix(netflow): проверять ответы настроек и подтверждения операций
This commit is contained in:
1 parent
52cb93bf24
commit
4af4fdc544
6 files changed
+91
-26
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { SCHEDULER_JOB_KEYS } from "../../lib/scheduler-settings"
|
||||
import { test, expect, type Page } from "@playwright/test"
|
||||
import type { SpeedProbeApiRow } from "../../components/data-grids/probes-speed-probes-data-grid"
|
||||
|
||||
@@ -7,11 +8,14 @@ async function setup(page: Page, path: string) {
|
||||
dstInterface: "ether1", protocol: "tcp", direction: "both", durationSec: "10", enabled: true,
|
||||
lastRunAt: null, lastTxAvgMbps: null, lastRxAvgMbps: null, lastStatus: null, lastError: null,
|
||||
}))
|
||||
const jobs = SCHEDULER_JOB_KEYS.map(jobKey => ({ jobKey, enabled: true, intervalSec: 300, running: false, lastFinishedAt: null, lastStatus: null, lastDurationMs: 0, lastError: null }))
|
||||
const calls: string[] = []
|
||||
await page.route("**/health", route => route.fulfill({ json: { ok: true } }))
|
||||
await page.route("**/api/**", route => {
|
||||
const path = new URL(route.request().url()).pathname
|
||||
if (route.request().method() === "POST") calls.push(path)
|
||||
if (path === "/api/scheduler/status") return route.fulfill({ json: { jobs } })
|
||||
if (path === "/api/scheduler/jobs/alert_engine/run-now") return route.fulfill({ json: { ok: true, result: { status: "ok", error: null, result: { v: 1, job: "alert_engine", sampledAt: "2026-10-03T00:00:00Z", rulesChecked: 0, standaloneFires: 0, groupFires: 0, skippedNoTelegram: false } }, status: { jobs } } })
|
||||
return route.fulfill({ json: path === "/api/uptime/speed-probes" ? { probes }
|
||||
: path === "/api/auth/config" ? { required: false } : path === "/api/servers" ? []
|
||||
: path === "/api/evobgp/settings" ? { enabled: false, baseUrl: "", secretConfigured: false }
|
||||
@@ -26,7 +30,7 @@ async function setup(page: Page, path: string) {
|
||||
: path === "/api/scheduler/runs" ? { runs: [] }
|
||||
: path.endsWith("/settings") || path.endsWith("/renew-settings") ? {
|
||||
enabled: true, intervalSec: 300, retentionDays: 7, probeIntervalSec: 15, speedIntervalSec: 60,
|
||||
renewBeforeDays: 30, scheduler: { jobs: [] },
|
||||
resourcesEnabled: true, pingEnabled: true, speedEnabled: true, lastCollectedAt: null, lastDurationMs: 0, lastError: null, renewBeforeDays: 30, scheduler: { jobs: [] },
|
||||
} : {} })
|
||||
})
|
||||
await page.goto(path)
|
||||
@@ -52,6 +56,7 @@ test("Сбор данных: все 11 задач и запуск выбранн
|
||||
await page.getByRole("button", { name: "Запустить: Оповещения", exact: true }).click()
|
||||
await expect.poll(() => calls).toContain("/api/scheduler/jobs/alert_engine/run-now")
|
||||
await expect(rows).toHaveCount(11)
|
||||
await expect(page.getByText("Запуск подтверждён: Оповещения", { exact: true })).toBeVisible()
|
||||
})
|
||||
|
||||
test("Демо-расписание: сортировка интервала и удаление выбранного правила", async ({ page }) => {
|
||||
|
||||
Reference in new issue
Block a user