@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 73 lines 2.43 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 "getProjectsLocationsSourcesDatacenterConnectors on a missing connector 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.getProjectsLocationsSourcesDatacenterConnectors({
19 name: `projects/${project}/locations/us-central1/sources/alchemy-missing-source/datacenterConnectors/alchemy-missing-connector`,
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 datacenter connector",
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("ConnectorSource", {
41 aws: dummyAws,
42 });
43 return yield* GCP.VMMigration.SourcesDatacenterConnector("Appliance", {
44 source: source.name,
45 version: "1.0.0",
46 });
47 }),
48 );
49
50 expect(created.datacenterConnectorId).toEqual(expect.any(String));
51 expect(created.name).toContain("/datacenterConnectors/");
52 expect(created.source).toContain("/sources/");
53 expect(created.version).toEqual("1.0.0");
54
55 const fetched = yield* vmmigration.getProjectsLocationsSourcesDatacenterConnectors({
56 name: created.name,
57 });
58 expect(fetched.name).toEqual(created.name);
59 expect(fetched.version).toContain("alchemy-id=");
60
61 yield* stack.destroy();
62 const gone = yield* waitUntilGone(
63 vmmigration.getProjectsLocationsSourcesDatacenterConnectors({
64 name: created.name,
65 }),
66 );
67 expect(gone).toEqual("gone");
68 }).pipe(logLevel),
69 {
70 tags: ["provider:gcp", "provider:gcp:vmmigration", "live"],
71 timeout: 120_000,
72 },
73 );