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

Function TestIsValidDuckLakeSpecVersion

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

Source from the content-addressed store, hash-verified

1538 router.ServeHTTP(rec, req)
1539
1540 if rec.Code != http.StatusBadRequest {
1541 t.Fatalf("status = %d, want %d: %s", rec.Code, http.StatusBadRequest, rec.Body.String())
1542 }
1543 if !strings.Contains(rec.Body.String(), "SecretRef.Namespace") {
1544 t.Fatalf("expected explicit namespace validation error, got %s", rec.Body.String())
1545 }
1546}
1547
1548func TestPutWarehouseRejectsCrossTenantSecretReference(t *testing.T) {
1549 store := newFakeAPIStore()
1550 store.orgs["analytics"] = &configstore.Org{Name: "analytics"}
1551 router := newTestAPIRouter(store)
1552
1553 body := []byte(`{
1554 "worker_identity": {
1555 "namespace": "tenant-a"
1556 },
1557 "metadata_store_credentials": {
1558 "namespace": "tenant-b",
1559 "name": "analytics-metadata",
1560 "key": "dsn"
1561 }
1562 }`)
1563
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)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected