fix(gre): сохранять удалённый внутренний IP туннеля

This commit is contained in:
Denozordec committed 2026-10-08 15:50:11 +07:00
1 parent 56f29a60d1
commit bd3f996f55
12 files changed
+112 -14

No files matched your search

+3 -1
View File
@@ -2,6 +2,7 @@ import { test, expect } from "@playwright/test"
for (const mode of ["create", "dto", "edit"]) {
test(`GRE: сохранение ${mode} подтверждается API`, async ({ page }) => {
let attempts = 0
const remoteInnerIp = mode === "edit" ? "" : "10.0.0.2/30"
let release: (() => void) | undefined
const gate = new Promise<void>(resolve => { release = resolve })
const tunnel = { id: "*T/1", name: "gre-test", serverId: "1", localAddress: "192.0.2.1", remoteAddress: "192.0.2.2", localInnerIp: "10.0.0.1/30", remoteInnerIp: "10.0.0.2/30", poolId: "pool", ipsec: null, mtu: 1476, keepaliveInterval: 10, keepaliveRetries: 3, dscp: "inherit", clampTcpMss: true, allowFastPath: true, comment: "", enabled: true, status: "up" }
@@ -12,7 +13,7 @@ for (const mode of ["create", "dto", "edit"]) {
if (route.request().method() === (mode === "edit" ? "PATCH" : "POST")) {
attempts++
expect(path).toBe("/api/gre/tunnels")
expect(route.request().postDataJSON()).toMatchObject({ serverId: "1", name: "gre-test", remoteAddress: "192.0.2.9", comment: "сохранённый ввод" })
expect(route.request().postDataJSON()).toMatchObject({ serverId: "1", name: "gre-test", remoteAddress: "192.0.2.9", remoteInnerIp, comment: "сохранённый ввод" })
if (mode === "edit") expect(route.request().postDataJSON().rosId).toBe("*T/1")
if (attempts === 1) { await gate; return route.fulfill({ status: 403, json: { error: "Запись запрещена тест" } }) }
if (attempts === 2) return route.fulfill({ json: {} })
@@ -38,6 +39,7 @@ for (const mode of ["create", "dto", "edit"]) {
}
await sheet.getByLabel("Удалённый адрес").fill("192.0.2.9")
await sheet.getByLabel("Комментарий").fill("сохранённый ввод")
await sheet.getByLabel("Удалённый IP", { exact: true }).fill(remoteInnerIp)
const submit = sheet.getByRole("button", { name: mode === "edit" ? "Сохранить" : "Создать туннель", exact: true })
await submit.evaluate(button => { (button as HTMLButtonElement).click(); (button as HTMLButtonElement).click() })
await expect.poll(() => attempts).toBe(1)