The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import * as GCP from "@alchemy.run/gcp"; |
| 2 | import { GcpEnvironment } from "@alchemy.run/gcp/Environment"; |
| 3 | import { expect } from "@alchemy.run/test"; |
| 4 | import * as Test from "@alchemy.run/test/Alchemy"; |
| 5 | import * as metastore from "@distilled.cloud/gcp/metastore_v1"; |
| 6 | import * as Effect from "effect/Effect"; |
| 7 | import { MinimumLogLevel } from "effect/References"; |
| 8 | import { isServiceEnabled } from "../ServiceState.ts"; |
| 9 | |
| 10 | const { test } = Test.make({ providers: GCP.providers() }); |
| 11 | |
| 12 | const logLevel = Effect.provideService(MinimumLogLevel, process.env.DEBUG ? "Debug" : "Info"); |
| 13 | |
| 14 | test.provider( |
| 15 | "getProjectsLocationsServices on a missing service fails with a typed tag", |
| 16 | (stack) => |
| 17 | Effect.gen(function* () { |
| 18 | const { project } = yield* GcpEnvironment.current; |
| 19 | yield* stack.destroy(); |
| 20 | |
| 21 | const error = yield* Effect.flip( |
| 22 | metastore.getProjectsLocationsServices({ |
| 23 | name: `projects/${project}/locations/us-central1/services/alchemy-missing-service`, |
| 24 | }), |
| 25 | ); |
| 26 | expect(["ServiceDisabled", "NotFound"]).toContain(error._tag); |
| 27 | |
| 28 | yield* stack.destroy(); |
| 29 | }).pipe(logLevel), |
| 30 | { tags: ["provider:gcp", "provider:gcp:metastore", "live"], timeout: 90_000 }, |
| 31 | ); |
| 32 | |
| 33 | test.provider( |
| 34 | "create is rejected when the Dataproc Metastore API is disabled", |
| 35 | (stack) => |
| 36 | Effect.gen(function* () { |
| 37 | // Only meaningful while the API is disabled: enabled, the create would |
| 38 | // provision a real resource. |
| 39 | if (yield* isServiceEnabled("metastore.googleapis.com")) return; |
| 40 | yield* stack.destroy(); |
| 41 | |
| 42 | const error = yield* Effect.flip( |
| 43 | stack.deploy( |
| 44 | Effect.gen(function* () { |
| 45 | return yield* GCP.Metastore.Service("Hive", { |
| 46 | location: "us-central1", |
| 47 | hiveMetastoreConfig: { version: "3.1.2" }, |
| 48 | tier: "DEVELOPER", |
| 49 | labels: { env: "test" }, |
| 50 | }); |
| 51 | }), |
| 52 | ), |
| 53 | ); |
| 54 | expect(error._tag).toEqual("ServiceDisabled"); |
| 55 | |
| 56 | yield* stack.destroy(); |
| 57 | }).pipe(logLevel), |
| 58 | { tags: ["provider:gcp", "provider:gcp:metastore", "live"], timeout: 90_000 }, |
| 59 | ); |