The best way to control Claude Code, Codex and more from any computer or phone

main
ts 67 lines 2.43 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { Addon } from "@alchemy.run/aws/EKS";
3 import { expect } from "@alchemy.run/test";
4 import * as Test from "@alchemy.run/test/Alchemy";
5 import * as Provider from "alchemy/Provider";
6 import * as Effect from "effect/Effect";
7
8 const { test } = Test.make({ providers: AWS.providers() });
9
10 // Ungated probe: `list()` enumerates every cluster, lists each cluster's
11 // add-ons, then hydrates each via `describeAddon`. It requires no deployed
12 // resource — in a clean account/region it returns `[]`, otherwise a
13 // well-formed array of full Add-on Attributes. This proves the enumeration
14 // wiring (listClusters -> listAddons -> describeAddon) compiles and runs live
15 // without needing a ~10-minute cluster create.
16 test.provider(
17 "list returns a well-formed array of add-ons",
18 (stack) =>
19 Effect.gen(function* () {
20 yield* stack.destroy();
21
22 const provider = yield* Provider.findProvider(Addon);
23 const all = yield* provider.list();
24
25 expect(Array.isArray(all)).toBe(true);
26 for (const addon of all) {
27 expect(typeof addon.addonArn).toBe("string");
28 expect(typeof addon.addonName).toBe("string");
29 expect(typeof addon.clusterName).toBe("string");
30 }
31 }),
32 { tags: ["provider:aws", "provider:aws:eks", "live"] },
33 );
34
35 // Full deploy test: an EKS cluster takes ~10+ minutes to provision, which is
36 // far too heavy for CI. Gate the deploy behind a pre-existing cluster supplied
37 // via AWS_TEST_EKS_CLUSTER; an entitled account with a standing cluster runs
38 // this unchanged. Deploys `metrics-server`, asserts it appears in the
39 // exhaustively-paginated `list()`, then tears down.
40 test.provider.skipIf(!process.env.AWS_TEST_EKS_CLUSTER)(
41 "list enumerates the deployed add-on",
42 (stack) =>
43 Effect.gen(function* () {
44 yield* stack.destroy();
45
46 const clusterName = process.env.AWS_TEST_EKS_CLUSTER!;
47
48 const addon = yield* stack.deploy(
49 Effect.gen(function* () {
50 return yield* Addon("ListAddon", {
51 clusterName,
52 addonName: "metrics-server",
53 });
54 }),
55 );
56
57 const provider = yield* Provider.findProvider(Addon);
58 const all = yield* provider.list();
59
60 expect(
61 all.some((a) => a.clusterName === addon.clusterName && a.addonName === addon.addonName),
62 ).toBe(true);
63
64 yield* stack.destroy();
65 }),
66 { tags: ["provider:aws", "provider:aws:eks", "live"], timeout: 600_000 },
67 );