(t *testing.T)
| 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 | |
| 1577 | func 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) |
nothing calls this directly
no test coverage detected