@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

main
ts 65 lines 2.32 KB
Raw
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 "getProjectsLocationsBackupPlansBackups on a missing backup 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.getProjectsLocationsBackupPlansBackups({
23 name: `projects/${project}/locations/us-central1/backupPlans/alchemy-missing-plan/backups/alchemy-missing-backup`,
24 }),
25 );
26 expect(error._tag).toEqual("NotFound");
27
28 const page = yield* gkebackup.listProjectsLocationsBackupPlansBackups({
29 parent: `projects/${project}/locations/-/backupPlans/-`,
30 pageSize: 10,
31 });
32 expect((page.backups ?? []).map((item) => item.name)).not.toContain(
33 `projects/${project}/locations/us-central1/backupPlans/alchemy-missing-plan/backups/alchemy-missing-backup`,
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 against a missing backup plan is rejected with a typed tag",
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.BackupPlansBackup("Snapshot", {
53 backupPlan: `projects/${project}/locations/us-central1/backupPlans/alchemy-missing-plan`,
54 description: "alchemy-test-backup",
55 labels: { env: "test" },
56 });
57 }),
58 ),
59 );
60 expect(error._tag).toEqual("NotFound");
61
62 yield* stack.destroy();
63 }).pipe(logLevel),
64 { tags: ["provider:gcp", "provider:gcp:gkebackup", "live"], timeout: 90_000 },
65 );