fix(test): обновить данные сквозных проверок дашборда
This commit is contained in:
1 parent
39789765cb
commit
b658f7127f
8 files changed
+91
-27
No files matched your search
@@ -2,7 +2,7 @@ import { test, expect, type Page } from "@playwright/test"
|
||||
|
||||
async function setup(page: Page, url: string, failed = 0) {
|
||||
const control = { payload: undefined as unknown, malformed: false, partial: false, failed, posts: [] as { path: string; body: unknown }[] }
|
||||
const servers = [{ id: 1, name: "Источник", host: "192.0.2.1", type: "exit-node", enabled: true, country: "RU", site: "TEST", asn: "64512", status: "online", latency: 1, os: "7", model: "CHR", wanUplinks: [] }]
|
||||
const servers = [{ id: 1, name: "Источник", host: "192.0.2.1", type: "exit-node", enabled: true, country: "RU", site: "TEST", asn: "64512", status: "online", latency: 1, os: "7", model: "CHR", sessions:0, wanUplinks: [] }]
|
||||
const tunnels = ["1", "2"].flatMap(serverId => ["*/2", "other"].map(id => ({ id, serverId, name: "vx-same", vni: Number(serverId) * 100 + (id === "other" ? 1 : 0), port: 0, dstPort: 8472, vtepIp: "192.0.2.1", remoteVteps: ["192.0.2.22"], l2mtu: 1500, arpProxy: false, macLearning: true, comment: "", enabled: true, status: "down" })))
|
||||
servers.push({ ...servers[0], id: 2, name: "Второй сервер", host: "192.0.2.2" });
|
||||
const probes = ["p1", "p/2"].map(id => ({ id, srcServerId: "1", name: "Проверка сети", target: "192.0.2.10", filter: "main", rtt: null, loss: 100, status: "down", series: [0], enabled: true, showOnDashboard: false }))
|
||||
@@ -17,16 +17,16 @@ async function setup(page: Page, url: string, failed = 0) {
|
||||
const json = path === "/api/auth/config" ? { required: false }
|
||||
: path === "/api/evobgp/settings" ? { enabled: false, baseUrl: "", secretConfigured: false }
|
||||
: path === "/api/servers" ? servers
|
||||
: path === "/api/uptime/overview" ? { probes, resources: [] }
|
||||
: path === "/api/uptime/overview" ? { probes:probes.map(p=>({...p,observations:{samples:[{sampledAt:"2026-09-20T00:00:00Z",rtt:null,loss:100,status:"down"}]}})),rangeStartAt:"2026-09-19T23:00:00Z",rangeEndAt:"2026-09-20T00:00:00Z",resources: [] }
|
||||
: path === "/api/uptime/speed-probes" ? { probes: [] }
|
||||
: path === "/api/uptime/speed-test/runs" ? { runs: [] }
|
||||
: path === "/api/bgp/sessions" ? []
|
||||
: path === "/api/bgp/catalog" ? {sessions:[],failures:[]}
|
||||
: 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/filters/gre-tunnels" ? { tunnels: [],failures:[] }
|
||||
: path === "/api/wireguard" ? { interfaces: [], peers: [],failures:[] }
|
||||
: path === "/api/traffic/servers" ? { servers: [] }
|
||||
: path === "/api/events" ? { events: [] }
|
||||
: path === "/api/internet-path/latest" ? { snapshot: { sampledAt: "2026-09-20T00:00:00Z", servers, greTunnels: [], filtersRulesets: [], speedProbes: [], routeLookupByServerId: {}, wanRuntimeByHomeId: {} } }
|
||||
: path === "/api/internet-path/latest" ? { snapshot: { collectionComplete:true,sampledAt: "2026-09-20T00:00:00Z", servers, greTunnels: [], filtersRulesets: [], speedProbes: [], routeLookupByServerId: {}, wanRuntimeByHomeId: {} } }
|
||||
: {}
|
||||
return route.fulfill({ json })
|
||||
})
|
||||
@@ -196,7 +196,7 @@ for (const oldFails of [false, true]) {
|
||||
let attempts = 0
|
||||
await page.route("**/api/vxlan", async route => {
|
||||
attempts++
|
||||
if (attempts === 1) { await oldGate; return route.fulfill(oldFails ? { status: 500, json: { error: "Поздняя ошибка тест" } } : { json: { tunnels: [] } }) }
|
||||
if (attempts === 1) { await oldGate; return route.fulfill(oldFails ? { status: 500, json: { error: "Поздняя ошибка тест" } } : { json: { tunnels: [],failures:[] } }) }
|
||||
await newGate
|
||||
return route.fallback()
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user