chore(ui): зафиксировать профиль полной таблицы маршрутов
This commit is contained in:
1 parent
059fd93520
commit
82f620ac0b
6 files changed
+44
-2
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { test, expect } from "@playwright/test"
|
||||
import { writeFileSync } from "node:fs"
|
||||
import { optimizerServersSchema } from "../../lib/route-optimizer-response"
|
||||
|
||||
test("Оптимизатор1000 маршрутов: WAN10 × JH10 × Exit10", async ({ page }, info) => {
|
||||
test.setTimeout(90000)
|
||||
const common = { host: "192.0.2.1", enabled: true, status: "online", latency: 10, country: "RU", site: "TEST", model: "CHR" }
|
||||
const servers = optimizerServersSchema.parse([
|
||||
{ ...common, id: 1, name: "Домашний роутер", type: "home-router", wanUplinks: Array.from({ length: 10 }, (_, i) => ({ id: `wan${i+1}`, name: `WAN${i+1}`, isp: "ISP", iface: `ether${i+1}`, ip: `198.51.100.${i+1}`, maxDl: 100, maxUl: 100 })) },
|
||||
...Array.from({ length: 10 }, (_, i) => ({ ...common, id: i+2, name: `Jump ${i+1}`, type: "jump-host" })),
|
||||
...Array.from({ length: 10 }, (_, i) => ({ ...common, id: i+12, name: `Exit ${i+1}`, type: "exit-node" })),
|
||||
])
|
||||
await page.route("**/health", r => r.fulfill({ json: { ok: true } }))
|
||||
await page.route("**/api/**", r => {
|
||||
const path = new URL(r.request().url()).pathname
|
||||
return r.fulfill({ json: path === "/api/auth/config" ? { required: false } : path === "/api/servers" ? servers : path === "/api/filters/rules" ? { rulesets: [] } : path === "/api/uptime/speed-probes" ? { probes: [] } : path === "/api/ospf/catalog" ? { interfaces: [], instances: [], neighbors: [], bfdSessions: [], routes: [], failures: [] } : path.endsWith("/ospf/optimize/preview") ? { serverId: 1, serverName: "Домашний роутер", pingWeight: 60, interfacesTotal: 0, changedCount: 0, unchangedCount: 0, interfaces: [], changes: [] } : {} })
|
||||
})
|
||||
const start = Date.now(); await page.goto("/route-optimizer?server=1&keep=1")
|
||||
await page.getByRole("button", { name: "Маршруты (1000)", exact: true }).click()
|
||||
const table = page.getByRole("table").filter({ hasText: "# Маршрут" })
|
||||
await expect(table.locator("tr[data-row-id]")).toHaveCount(5)
|
||||
await page.getByRole("button", { name: "Показать все 1000 комбинаций", exact: true }).click()
|
||||
await expect(table.locator("tr[data-row-id]")).toHaveCount(1000)
|
||||
const profile = { combinations: 1000, servers: servers.length, bytes: Buffer.byteLength(JSON.stringify(servers)), rendered: await table.locator("tr[data-row-id]").count(), tableNodes: await table.locator("*").count(), pageNodes: await page.locator("*").count(), readyMs: Date.now()-start }
|
||||
console.log("Optimizer full routes", JSON.stringify(profile)); writeFileSync(info.outputPath("optimizer-routes-profile.json"), JSON.stringify(profile, null, 2))
|
||||
})
|
||||
Reference in new issue
Block a user