fix(ui): показывать частичные сбои опроса VXLAN

This commit is contained in:
Denozordec committed 2026-09-30 09:42:43 +07:00
1 parent 4dc2ee2129
commit e163a9ed9d
9 files changed
+120 -41

No files matched your search

+28 -1
View File
@@ -20,7 +20,7 @@ async function setup(page: Page, url: string, failed = 0) {
: path === "/api/uptime/speed-probes" ? { probes: [] }
: path === "/api/uptime/speed-test/runs" ? { runs: [] }
: path === "/api/bgp/sessions" ? []
: path === "/api/vxlan" ? { tunnels }
: path === "/api/vxlan" ? { tunnels: control.partial ? tunnels.filter(t => t.serverId === "1") : tunnels, failures: control.partial ? [{ serverId: "2", serverName: "Второй сервер", error: "offline" }] : [] }
: path === "/api/filters/gre-tunnels" ? { tunnels: [] }
: path === "/api/wireguard" ? { interfaces: [], peers: [] }
: path === "/api/traffic/servers" ? { servers: [] }
@@ -131,3 +131,30 @@ for (const initiallyFailed of [true, false]) {
await expect(page.getByText("Ошибка загрузки:", { exact: false })).toHaveCount(0)
})
}
test("VXLAN: частичный сбой сохраняет туннели и неизвестный статус", async ({ page }) => {
const control = await setup(page, "/vxlan?server=2")
const rows = page.locator("tr[data-row-id]")
await expect(rows).toHaveCount(2)
control.partial = true
await page.getByRole("button", { name: "Обновить", exact: true }).click()
await expect(page.getByRole("alert").filter({ hasText: "Не все устройства ответили" })).toContainText("Второй сервер")
await expect(rows).toHaveCount(2)
await expect(rows.first()).toContainText("Неизвестно")
await expect(page.getByLabel("Сводка VXLAN")).toContainText("—")
control.partial = false
await page.getByRole("button", { name: "Повторить опрос" }).click()
await expect(page.getByText("Не все устройства ответили", { exact: true })).toHaveCount(0)
await expect(rows.first()).toContainText("DOWN")
})
test("VXLAN: первый частичный сбой не выглядит пустым устройством", async ({ page }) => {
const control = await setup(page, "/vxlan?server=2")
await expect(page.locator("tr[data-row-id]")).toHaveCount(2)
control.partial = true
await page.reload()
await expect(page.getByText("Не все устройства ответили", { exact: true })).toBeVisible()
await expect(page.locator("tr[data-row-id]")).toHaveCount(0)
await expect(page.getByText("На опрошенных серверах нет VXLAN-интерфейсов", { exact: true })).toHaveCount(0)
await expect(page.getByLabel("Сводка VXLAN")).toContainText("—")
})