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

main
ts 49 lines 1.87 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { RouteTable, Vpc } from "@alchemy.run/aws/EC2";
3 import { expect } from "@alchemy.run/test";
4 import * as Provider from "alchemy/Provider";
5 import * as Effect from "effect/Effect";
6 import { MinimumLogLevel } from "effect/References";
7 import { assertRouteTableGone, assertVpcGone } from "./Gone.ts";
8 import * as Test from "./VpcTest.ts";
9
10 const { test } = Test.make({ providers: AWS.providers() });
11
12 const logLevel = Effect.provideService(MinimumLogLevel, process.env.DEBUG ? "Debug" : "Info");
13
14 test.provider(
15 "list enumerates the deployed RouteTable",
16 (stack) =>
17 Effect.gen(function* () {
18 yield* stack.destroy();
19
20 const { vpc, routeTable } = yield* stack.deploy(
21 Effect.gen(function* () {
22 const vpc = yield* Vpc("ListRouteTableVpc", {
23 cidrBlock: "10.0.0.0/16",
24 });
25 const routeTable = yield* RouteTable("ListRouteTable", {
26 vpcId: vpc.vpcId,
27 });
28 return { vpc, routeTable };
29 }),
30 );
31
32 const provider = yield* Provider.findProvider(RouteTable);
33 const all = yield* provider.list();
34
35 expect(all.some((x) => x.routeTableId === routeTable.routeTableId)).toBe(true);
36
37 yield* stack.destroy();
38
39 yield* assertRouteTableGone(routeTable.routeTableId);
40 yield* assertVpcGone(vpc.vpcId);
41 }).pipe(logLevel),
42 // VPC + RouteTable create, an account-wide DescribeRouteTables, then two
43 // destroys (with VPC dependency-ordered teardown) can exceed the default
44 // 120s under full-suite EC2 throttling load. All waits are bounded; give
45 // the end-to-end run headroom. (Observed blowing 180s during a full-suite
46 // run where concurrent EC2 suites saturated the account's request budget
47 // and VPC quota; a timeout mid-destroy also leaks the VPC.)
48 { tags: ["provider:aws", "provider:aws:ec2", "live"], timeout: 300_000 },
49 );