@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 75 lines 2.49 KB
Raw
1 import * as GCP from "@alchemy.run/gcp";
2 import { expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as vmmigration from "@distilled.cloud/gcp/vmmigration_v1";
5 import * as Effect from "effect/Effect";
6 import { dummyAws, logLevel, currentProject, runSourceLifecycle, waitUntilGone } from "./common.ts";
7
8 const { test } = Test.make({ providers: GCP.providers() });
9
10 test.provider(
11 "getProjectsLocationsSourcesUtilizationReports on a missing report fails with a typed tag",
12 (stack) =>
13 Effect.gen(function* () {
14 const project = yield* currentProject;
15 yield* stack.destroy();
16
17 const error = yield* Effect.flip(
18 vmmigration.getProjectsLocationsSourcesUtilizationReports({
19 name: `projects/${project}/locations/us-central1/sources/alchemy-missing-source/utilizationReports/alchemy-missing-report`,
20 }),
21 );
22 expect(error._tag).toEqual("NotFound");
23
24 yield* stack.destroy();
25 }).pipe(logLevel),
26 {
27 tags: ["provider:gcp", "provider:gcp:vmmigration", "live"],
28 timeout: 90_000,
29 },
30 );
31
32 test.provider.skipIf(!runSourceLifecycle)(
33 "create and delete a vm migration utilization report",
34 (stack) =>
35 Effect.gen(function* () {
36 yield* stack.destroy();
37
38 const created = yield* stack.deploy(
39 Effect.gen(function* () {
40 const source = yield* GCP.VMMigration.Source("ReportSource", {
41 aws: dummyAws,
42 });
43 return yield* GCP.VMMigration.SourcesUtilizationReport("Week", {
44 source: source.name,
45 timeFrame: "WEEK",
46 displayName: "weekly",
47 vms: [{ vmId: "i-0123456789abcdef0" }],
48 });
49 }),
50 );
51
52 expect(created.utilizationReportId).toEqual(expect.any(String));
53 expect(created.name).toContain("/utilizationReports/");
54 expect(created.timeFrame).toEqual("WEEK");
55 expect(created.displayName).toEqual("weekly");
56
57 const fetched = yield* vmmigration.getProjectsLocationsSourcesUtilizationReports({
58 name: created.name,
59 });
60 expect(fetched.name).toEqual(created.name);
61 expect(fetched.displayName).toContain("alchemy-id=");
62
63 yield* stack.destroy();
64 const gone = yield* waitUntilGone(
65 vmmigration.getProjectsLocationsSourcesUtilizationReports({
66 name: created.name,
67 }),
68 );
69 expect(gone).toEqual("gone");
70 }).pipe(logLevel),
71 {
72 tags: ["provider:gcp", "provider:gcp:vmmigration", "live"],
73 timeout: 120_000,
74 },
75 );