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 gkebackup from "@distilled.cloud/gcp/gkebackup_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 | "getProjectsLocationsRestoreChannels on a missing channel fails with a typed tag", |
| 15 | (stack) => |
| 16 | Effect.gen(function* () { |
| 17 | const { project } = yield* GcpEnvironment.current; |
| 18 | |
| 19 | yield* stack.destroy(); |
| 20 | |
| 21 | const error = yield* Effect.flip( |
| 22 | gkebackup.getProjectsLocationsRestoreChannels({ |
| 23 | name: `projects/${project}/locations/us-central1/restoreChannels/alchemy-missing-channel`, |
| 24 | }), |
| 25 | ); |
| 26 | expect(error._tag).toEqual("NotFound"); |
| 27 | |
| 28 | const page = yield* gkebackup.listProjectsLocationsRestoreChannels({ |
| 29 | parent: `projects/${project}/locations/-`, |
| 30 | pageSize: 10, |
| 31 | }); |
| 32 | expect((page.restoreChannels ?? []).map((item) => item.name)).not.toContain( |
| 33 | `projects/${project}/locations/us-central1/restoreChannels/alchemy-missing-channel`, |
| 34 | ); |
| 35 | |
| 36 | yield* stack.destroy(); |
| 37 | }).pipe(logLevel), |
| 38 | { tags: ["provider:gcp", "provider:gcp:gkebackup", "live"], timeout: 90_000 }, |
| 39 | ); |
| 40 | |
| 41 | test.provider( |
| 42 | "create with same-project destination is rejected with BadRequest", |
| 43 | (stack) => |
| 44 | Effect.gen(function* () { |
| 45 | const { project } = yield* GcpEnvironment.current; |
| 46 | |
| 47 | yield* stack.destroy(); |
| 48 | |
| 49 | const error = yield* Effect.flip( |
| 50 | stack.deploy( |
| 51 | Effect.gen(function* () { |
| 52 | return yield* GCP.GKEBackup.RestoreChannel("Channel", { |
| 53 | destinationProject: `projects/${project}`, |
| 54 | description: "alchemy-test-channel", |
| 55 | labels: { env: "test" }, |
| 56 | }); |
| 57 | }), |
| 58 | ), |
| 59 | ); |
| 60 | expect(error._tag).toEqual("BadRequest"); |
| 61 | |
| 62 | yield* stack.destroy(); |
| 63 | }).pipe(logLevel), |
| 64 | { tags: ["provider:gcp", "provider:gcp:gkebackup", "live"], timeout: 90_000 }, |
| 65 | ); |