ci / vet-and-test (pull_request) Successful in 38s
Why: the approved collaboration plan U2 (KTD1/KTD8/KTD12) requires an explicit fail-closed team deployment tier, DDL-and-ledger-atomic migrations serialized across migrators, and a configurable PG connection budget with sanitized effective values. Evidence: real PostgreSQL 18.6 + pgvector + Redis 8.10.2 local gate - full backend suite green twice with AGENT_PG_TEST_DSN/AGENT_REDIS_TEST_ADDR (isolated svc.sh instance collabtest:8897, redis 6399); SQLite suite green without env. Impact: config tier+pool keys and validation; store PoolOptions + statement_timeout DSN param + single-transaction migration with PG advisory lock and SQLite _txlock=immediate + unknown-schema-version refusal; app tier guard fail-closed (team requires DSN+auth, no SQLite fallback); CLI flags and explain rows; tests for tier/pool parsing, atomicity fault-injection, racing migrators, old-schema upgrade; fixed pre-existing real-PG test defects (blind &search_path= appends in runmgr/pgbus helpers, pg_trgm per-schema install race, exhausted seq-conflict retries). Refs: proposals/2026-10-11-collaboration-storage-and-distribution.md U2, KTD1/KTD8/KTD12; R2/R3/R7.
32 lines
1.1 KiB
Go
32 lines
1.1 KiB
Go
package app
|
||
|
||
import (
|
||
"strings"
|
||
"testing"
|
||
)
|
||
|
||
// 协作存储方案 U2(KTD1/R2):服务入口的部署档门禁。
|
||
// team 档缺 DSN / 未开认证必须拒绝启动——不创建 SQLite、不进入装配。
|
||
func TestTierRefusalTeam(t *testing.T) {
|
||
msgs := TierRefusal(Options{Tier: "team", Addr: "127.0.0.1:8788"})
|
||
if len(msgs) != 2 {
|
||
t.Fatalf("team without dsn/auth: %v", msgs)
|
||
}
|
||
joined := strings.Join(msgs, ";")
|
||
if !strings.Contains(joined, "PostgreSQL DSN") || !strings.Contains(joined, "认证") {
|
||
t.Fatalf("refusal wording: %v", msgs)
|
||
}
|
||
msgs = TierRefusal(Options{Tier: "team", Addr: "127.0.0.1:8788", StorageDSN: "postgres://u:p@h/db", AuthMode: "on"})
|
||
if len(msgs) != 0 {
|
||
t.Fatalf("team with dsn+auth should pass: %v", msgs)
|
||
}
|
||
msgs = TierRefusal(Options{Tier: "local", Addr: "127.0.0.1:8788", StorageDSN: "postgres://u:p@h/db"})
|
||
if len(msgs) != 1 || !strings.Contains(msgs[0], "local 档不使用") {
|
||
t.Fatalf("local with dsn: %v", msgs)
|
||
}
|
||
msgs = TierRefusal(Options{Addr: "127.0.0.1:8788"})
|
||
if len(msgs) != 0 {
|
||
t.Fatalf("auto default: %v", msgs)
|
||
}
|
||
}
|