test(store): isolate firewall client integration from demo seed
quality / changes (push) Successful in 13s
quality / openapi (push) Skipped
quality / web (push) Skipped
quality / commitlint (push) Skipped
quality / docker-check (push) Skipped
quality / go (push) Successful in 1m15s
quality / postgres-integration (push) Successful in 2m6s
quality / legacy-compatibility (1.0.0) (push) Successful in 57s
quality / legacy-compatibility (2.56.2) (push) Successful in 1m10s
quality / bird2 (push) Successful in 24s
CD / quality (push) Successful in 9m1s
CD / publish (push) Failing after 58m14s

Тест ждал tenant со slug demo, а seedDemo создаёт его только в пустой базе. После соседних интеграционных тестов DemoIDs пустой, и проверка падала. Теперь тест создаёт и удаляет собственный tenant.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
DenozordecandCursor committed 2026-11-02 18:44:02 +07:00
1 parent e755974273
commit d4fbffe000
1 file changed
+9 -4
@@ -8,6 +8,8 @@ import (
"evobgp/internal/authkey"
"evobgp/internal/db"
"evobgp/internal/store"
"github.com/google/uuid"
)
func TestPostgresFirewallClientCreateAndGetIntegration(t *testing.T) {
@@ -21,14 +23,17 @@ func TestPostgresFirewallClientCreateAndGetIntegration(t *testing.T) {
t.Fatal(err)
}
defer pool.Close()
pg, err := NewPostgres(ctx, pool, true)
pg, err := NewPostgres(ctx, pool, false)
if err != nil {
t.Fatal(err)
}
tenant, _, _, _, _ := pg.DemoIDs()
if tenant == "" {
t.Fatal("demo tenant required")
tenant := uuid.NewString()
if _, err := pool.Exec(ctx, `INSERT INTO tenant (id, name, slug) VALUES ($1, $2, $3)`, tenant, "firewall", "fw-"+tenant); err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
_, _ = pool.Exec(context.Background(), `DELETE FROM tenant WHERE id = $1`, tenant)
})
tok := "evobgp_fw_pgtest_" + t.Name()
hash := authkey.HashToken(tok)
client, err := pg.CreateFirewallClient(tenant, &store.FirewallClientCreate{