The best way to control Claude Code, Codex and more from any computer or phone
| 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 | |
| 9 | const { test } = Test.make({ providers: GCP.providers() }); |
| 10 | |
| 11 | const logLevel = Effect.provideService(MinimumLogLevel, process.env.DEBUG ? "Debug" : "Info"); |
| 12 | |
| 13 | test.provider( |
| 14 | "getProjectsLocationsServicesBackups on a missing backup fails with a typed tag", |
| 15 | (stack) => |
| 16 | Effect.gen(function* () { |
| 17 | const { project } = yield* GcpEnvironment.current; |
| 18 | yield* stack.destroy(); |
| 19 | |
| 20 | const error = yield* Effect.flip( |
| 21 | metastore.getProjectsLocationsServicesBackups({ |
| 22 | name: `projects/${project}/locations/us-central1/services/alchemy-missing-service/backups/alchemy-missing-backup`, |
| 23 | }), |
| 24 | ); |
| 25 | expect(["ServiceDisabled", "NotFound"]).toContain(error._tag); |
| 26 | |
| 27 | yield* stack.destroy(); |
| 28 | }).pipe(logLevel), |
| 29 | { tags: ["provider:gcp", "provider:gcp:metastore", "live"], timeout: 90_000 }, |
| 30 | ); |
| 31 | |
| 32 | test.provider( |
| 33 | "create against a missing service is rejected with a typed tag", |
| 34 | (stack) => |
| 35 | Effect.gen(function* () { |
| 36 | const { project } = yield* GcpEnvironment.current; |
| 37 | yield* stack.destroy(); |
| 38 | |
| 39 | const error = yield* Effect.flip( |
| 40 | stack.deploy( |
| 41 | Effect.gen(function* () { |
| 42 | return yield* GCP.Metastore.ServicesBackup("Nightly", { |
| 43 | service: `projects/${project}/locations/us-central1/services/alchemy-missing-service`, |
| 44 | description: "alchemy-test-backup", |
| 45 | }); |
| 46 | }), |
| 47 | ), |
| 48 | ); |
| 49 | expect(["ServiceDisabled", "NotFound"]).toContain(error._tag); |
| 50 | |
| 51 | yield* stack.destroy(); |
| 52 | }).pipe(logLevel), |
| 53 | { tags: ["provider:gcp", "provider:gcp:metastore", "live"], timeout: 90_000 }, |
| 54 | ); |