Merge ha: replicated store, second control plane, join codes, setup and console screens
Release / build (push) Successful in 4m26s
Release / notes (push) Successful in 3s
CI / test (push) Successful in 5m14s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-03 22:59:49 +02:00
commit 36cdbce125
67 files changed
+8574 -490

No files matched your search

+25 -1
View File
@@ -43,7 +43,7 @@ func openPG(t *testing.T) *DB {
// every subtest gets a fresh file, and failed only here.
`TRUNCATE thread_messages, threads, memory_notes, usage, usage_5m, usage_1h, usage_1d, api_keys, memberships,
key_claims, limits, models, sessions, users, projects, teams,
organizations, leadership RESTART IDENTITY CASCADE`)
organizations, leadership, control_planes RESTART IDENTITY CASCADE`)
if err != nil {
t.Fatalf("clearing the test database: %v", err)
}
@@ -252,3 +252,27 @@ func TestPostgresBucketsUsageByEveryGrouping(t *testing.T) {
}
}
}
func TestPostgresMakesAnAdministrator(t *testing.T) {
// init --postgres and --patroni create the first administrator straight
// in PostgreSQL, which refused the bool SetAdmin sent.
ctx := context.Background()
s := openPG(t)
if err := s.CreateUser(ctx, User{ID: "u1", Email: "a@x", Name: "a", PasswordHash: "h",
State: UserActive, CreatedAt: time.Now()}); err != nil {
t.Fatal(err)
}
if err := s.SetAdmin(ctx, "u1", true); err != nil {
t.Fatalf("making an administrator: %v", err)
}
u, err := s.UserByEmail(ctx, "a@x")
if err != nil || !u.IsAdmin {
t.Fatalf("%+v, %v", u, err)
}
if err := s.SetAdmin(ctx, "u1", false); err != nil {
t.Fatal(err)
}
if u, _ := s.UserByEmail(ctx, "a@x"); u.IsAdmin {
t.Error("still an administrator")
}
}