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

Function TestUpdateOrgMaxVCPUsNullClearsToZero

controlplane/admin/api_test.go:1645–1668  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1643 "warehouse": {
1644 "state": "ready"
1645 }
1646 }`)
1647
1648 req := httptest.NewRequest(http.MethodPost, "/api/v1/orgs", bytes.NewReader(body))
1649 req.Header.Set("Content-Type", "application/json")
1650 rec := httptest.NewRecorder()
1651 router.ServeHTTP(rec, req)
1652
1653 if rec.Code != http.StatusBadRequest {
1654 t.Fatalf("status = %d, want %d: %s", rec.Code, http.StatusBadRequest, rec.Body.String())
1655 }
1656 if _, ok := store.orgs["analytics"]; ok {
1657 t.Fatal("expected org create to be rejected when warehouse payload is present")
1658 }
1659}
1660
1661func TestUpdateOrgRejectsNestedWarehousePayload(t *testing.T) {
1662 store := newFakeAPIStore()
1663 store.orgs["analytics"] = &configstore.Org{Name: "analytics", MaxWorkers: 2}
1664 router := newTestAPIRouter(store)
1665
1666 body := []byte(`{
1667 "max_workers": 4,
1668 "warehouse": {
1669 "state": "ready"
1670 }
1671 }`)

Callers

nothing calls this directly

Calls 3

newFakeAPIStoreFunction · 0.85
newTestAPIRouterFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected