(t *testing.T)
| 18 | "github.com/posthog/duckgres/controlplane/configstore" |
| 19 | integrationtest "github.com/posthog/duckgres/tests/integration" |
| 20 | "gorm.io/gorm" |
| 21 | ) |
| 22 | |
| 23 | func TestAdminAdmissionConfigMutationsSerializePostgres(t *testing.T) { |
| 24 | tests := []struct { |
| 25 | name string |
| 26 | orgID string |
| 27 | seed func(t *testing.T, store *configstore.ConfigStore) |
| 28 | mutation func(store *gormAPIStore) error |
| 29 | }{ |
| 30 | { |
| 31 | name: "update org", |
| 32 | orgID: "admission-update-org", |
| 33 | seed: func(t *testing.T, store *configstore.ConfigStore) { |
| 34 | t.Helper() |
| 35 | if err := store.DB().Create(&configstore.Org{Name: "admission-update-org", DatabaseName: "admission_update_org"}).Error; err != nil { |
| 36 | t.Fatalf("create org: %v", err) |
| 37 | } |
| 38 | }, |
| 39 | mutation: func(store *gormAPIStore) error { |
| 40 | _, found, err := store.UpdateOrg("admission-update-org", configstore.Org{MaxWorkers: 3, MaxVCPUs: 4}) |
| 41 | if err == nil && !found { |
| 42 | return errors.New("updated org was not found") |
| 43 | } |
| 44 | return err |
| 45 | }, |
| 46 | }, |
| 47 | { |
| 48 | name: "delete org", |
no test coverage detected