fix(ui): объединить параллельные связи OSPF в читаемый граф

This commit is contained in:
Denozordec committed 2026-10-04 17:37:42 +07:00
1 parent 086f118204
commit 9f74cfebfe
8 files changed
+43 -13

No files matched your search

+8 -2
View File
@@ -127,13 +127,13 @@ test("OSPF topology: полный статус, страницы связей и
})
test("OSPF: тысяча параллельных связей не обходит ограничение графа", async ({ page }) => {
test("OSPF: тысяча параллельных связей не обходит ограничение графа", async ({ page }, info) => {
const host = { serverId: 1, serverName: "Роутер 1", serverSite: "", serverCountry: "RU" }
let neighbors = Array.from({ length: 1000 }, (_, i) => ({ ...host, id: `n${i + 1}`, address: `10.${Math.floor(i / 256)}.${i % 256}.1`, routerId: `10.${Math.floor(i / 256)}.${i % 256}.1`, instance: "default", area: "backbone", areaId: "0.0.0.0", interface: `ether${i + 1}`, state: "Full", uptime: "1h", stateChanges: 0, priority: 1 }))
const interfaces = neighbors.map((n, i) => ({ ...host, id: `i${i + 1}`, instance: "default", area: "backbone", areaId: "0.0.0.0", interface: n.interface, cost: i + 1, type: "broadcast", disabled: false, inactive: false, priority: 1, helloInterval: 10, deadInterval: 40, useBfd: false }))
const catalog = ospfCatalogSchema.parse({ neighbors, interfaces, instances: [{ ...host, id: "instance1", name: "default", routerId: "192.0.2.1", version: 2, disabled: false, inactive: false, redistribute: "" }], bfdSessions: [], routes: [], failures: [] })
neighbors = neighbors.map(n => ({ ...n, routerId: "10.0.0.1", address: "10.0.0.1" }))
neighbors = neighbors.map((n, index) => ({ ...n, routerId: "10.0.0.1", address: "10.0.0.1", state: index % 2 ? "Down" : "Full" }))
await page.route("**/health", r => r.fulfill({ json: { ok: true } }))
await page.route("**/api/**", r => {
const path = new URL(r.request().url()).pathname
@@ -143,6 +143,12 @@ test("OSPF: тысяча параллельных связей не обходи
await expect(page.getByRole("region", { name: "Область топологии OSPF" }).getByRole("status")).toContainText("Показаны 2 из 2 узлов. Связи узла: 1–8 из 1000")
await expect(page.locator("[data-ospf-node]")).toHaveCount(2)
expect(await page.getByRole("group", { name: "Топология OSPF", exact: true }).locator("*").count()).toBeLessThan(200)
const visual = page.locator('[data-ospf-links="8"]')
await expect(visual).toHaveCount(1)
await expect(visual).toHaveAttribute("aria-label", /Full, cost 1; Down, cost 2/)
await expect(visual.locator("text")).toHaveText("8 связей")
await page.addStyleTag({ content: "nextjs-portal{display:none!important}" })
await page.screenshot({ path: info.outputPath("ospf-parallel-links-1440.png"), animations: "disabled" })
})