(t *testing.T)
| 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) |
| 1597 | |
| 1598 | if rec.Code != http.StatusBadRequest { |
| 1599 | t.Fatalf("status = %d, want %d: %s", rec.Code, http.StatusBadRequest, rec.Body.String()) |
| 1600 | } |
| 1601 | if _, ok := store.warehouses["analytics"]; ok { |
| 1602 | t.Fatal("expected invalid warehouse payload to be rejected") |
| 1603 | } |
| 1604 | } |
| 1605 | |
| 1606 | func TestPutWarehouseRejectsSecretReferenceWithoutOrgPrefix(t *testing.T) { |
| 1607 | store := newFakeAPIStore() |
| 1608 | store.orgs["analytics"] = &configstore.Org{Name: "analytics"} |
| 1609 | router := newTestAPIRouter(store) |
| 1610 | |
| 1611 | body := []byte(`{ |
| 1612 | "duckling_name": "analytics", |
| 1613 | "worker_identity": { |
| 1614 | "namespace": "tenant-a" |
| 1615 | }, |
| 1616 | "metadata_store_credentials": { |
| 1617 | "namespace": "tenant-a", |
| 1618 | "name": "shared-analytics-metadata", |
| 1619 | "key": "dsn" |
| 1620 | } |
| 1621 | }`) |
nothing calls this directly
no test coverage detected