MCPcopy Create free account
hub / github.com/PostHog/duckgres / newPostgresConfigStore

Function newPostgresConfigStore

controlplane/admin/api_postgres_test.go:20–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18 "github.com/posthog/duckgres/controlplane/configstore"
19 integrationtest "github.com/posthog/duckgres/tests/integration"
20 "gorm.io/gorm"
21)
22
23func 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",

Calls 5

DBMethod · 0.95
NewConfigStoreFunction · 0.92
startIntegrationPostgresFunction · 0.85
resetConfigStoreTablesFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected