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

Function TestUpdateOrgMaxVCPUs

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

Source from the content-addressed store, hash-verified

1564 req := httptest.NewRequest(http.MethodPut, "/api/v1/orgs/analytics/warehouse", bytes.NewReader(body))
1565 req.Header.Set("Content-Type", "application/json")
1566 rec := httptest.NewRecorder()
1567 router.ServeHTTP(rec, req)
1568
1569 if rec.Code != http.StatusBadRequest {
1570 t.Fatalf("status = %d, want %d: %s", rec.Code, http.StatusBadRequest, rec.Body.String())
1571 }
1572 if _, ok := store.warehouses["analytics"]; ok {
1573 t.Fatal("expected invalid warehouse payload to be rejected")
1574 }
1575}
1576
1577func TestPutWarehouseRejectsSecretReferenceOutsideOrgPrefix(t *testing.T) {
1578 store := newFakeAPIStore()
1579 store.orgs["analytics"] = &configstore.Org{Name: "analytics"}
1580 router := newTestAPIRouter(store)
1581
1582 body := []byte(`{
1583 "worker_identity": {
1584 "namespace": "tenant-a"
1585 },
1586 "metadata_store_credentials": {
1587 "namespace": "tenant-a",
1588 "name": "shared-metadata",
1589 "key": "dsn"
1590 }
1591 }`)
1592
1593 req := httptest.NewRequest(http.MethodPut, "/api/v1/orgs/analytics/warehouse", bytes.NewReader(body))
1594 req.Header.Set("Content-Type", "application/json")
1595 rec := httptest.NewRecorder()
1596 router.ServeHTTP(rec, req)

Callers

nothing calls this directly

Calls 3

newFakeAPIStoreFunction · 0.85
newTestAPIRouterFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected