t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/GCP/Metastore/Federation.test.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

64 lines
2 KiB
TypeScript

import * as GCP from "@/GCP";
import * as Test from "@/Test/Alchemy";
import * as metastore from "@distilled.cloud/gcp/metastore_v1";
import { expect } from "alchemy-test";
import * as Effect from "effect/Effect";
import { MinimumLogLevel } from "effect/References";
import { GcpEnvironment } from "@/GCP/Environment";
const { test } = Test.make({ providers: GCP.providers() });
const logLevel = Effect.provideService(
MinimumLogLevel,
process.env.DEBUG ? "Debug" : "Info",
);
test.provider(
"getProjectsLocationsFederations on a missing federation fails with a typed tag",
(stack) =>
Effect.gen(function* () {
const { project } = yield* GcpEnvironment.current;
yield* stack.destroy();
const error = yield* Effect.flip(
metastore.getProjectsLocationsFederations({
name: `projects/${project}/locations/us-central1/federations/alchemy-missing-federation`,
}),
);
expect(error._tag).toEqual("ServiceDisabled");
yield* stack.destroy();
}).pipe(logLevel),
{ tags: ["provider:gcp", "provider:gcp:metastore", "live"], timeout: 90_000 },
);
test.provider(
"create is rejected when the Dataproc Metastore API is disabled",
(stack) =>
Effect.gen(function* () {
const { project } = yield* GcpEnvironment.current;
yield* stack.destroy();
const error = yield* Effect.flip(
stack.deploy(
Effect.gen(function* () {
return yield* GCP.Metastore.Federation("Lakehouse", {
location: "us-central1",
version: "3.1.2",
backendMetastores: {
"1": {
name: `projects/${project}`,
metastoreType: "BIGQUERY",
},
},
labels: { env: "test" },
});
}),
),
);
expect(error._tag).toEqual("ServiceDisabled");
yield* stack.destroy();
}).pipe(logLevel),
{ tags: ["provider:gcp", "provider:gcp:metastore", "live"], timeout: 90_000 },
);