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
| 1 | import * as AWS from "@alchemy.run/aws"; |
| 2 | import { RouteTable, Vpc, VpcEndpoint } from "@alchemy.run/aws/EC2"; |
| 3 | import { AWSEnvironment } from "@alchemy.run/aws/Environment"; |
| 4 | import { expect } from "@alchemy.run/test"; |
| 5 | import * as Provider from "alchemy/Provider"; |
| 6 | import * as Effect from "effect/Effect"; |
| 7 | import { MinimumLogLevel } from "effect/References"; |
| 8 | import { assertVpcGone } from "./Gone.ts"; |
| 9 | import * as Test from "./VpcTest.ts"; |
| 10 | |
| 11 | const { test } = Test.make({ providers: AWS.providers() }); |
| 12 | |
| 13 | const logLevel = Effect.provideService(MinimumLogLevel, process.env.DEBUG ? "Debug" : "Info"); |
| 14 | |
| 15 | test.provider( |
| 16 | "list enumerates the deployed VpcEndpoint", |
| 17 | (stack) => |
| 18 | Effect.gen(function* () { |
| 19 | const { region } = yield* AWSEnvironment.current; |
| 20 | |
| 21 | yield* stack.destroy(); |
| 22 | |
| 23 | const deployed = yield* stack.deploy( |
| 24 | Effect.gen(function* () { |
| 25 | const vpc = yield* Vpc("ListVpceVpc", { cidrBlock: "10.0.0.0/16" }); |
| 26 | const routeTable = yield* RouteTable("ListVpceRouteTable", { vpcId: vpc.vpcId }); |
| 27 | const endpoint = yield* VpcEndpoint("ListVpceEndpoint", { |
| 28 | vpcId: vpc.vpcId, |
| 29 | serviceName: `com.amazonaws.${region}.s3`, |
| 30 | vpcEndpointType: "Gateway", |
| 31 | routeTableIds: [routeTable.routeTableId], |
| 32 | }); |
| 33 | return { vpc, endpoint }; |
| 34 | }), |
| 35 | ); |
| 36 | |
| 37 | const provider = yield* Provider.findProvider(VpcEndpoint); |
| 38 | const all = yield* provider.list(); |
| 39 | |
| 40 | expect(all.some((x) => x.vpcEndpointId === deployed.endpoint.vpcEndpointId)).toBe(true); |
| 41 | |
| 42 | yield* stack.destroy(); |
| 43 | |
| 44 | // The VPC cannot delete while the endpoint or route table exist — |
| 45 | // VPC-gone proves full teardown. |
| 46 | yield* assertVpcGone(deployed.vpc.vpcId); |
| 47 | }).pipe(logLevel), |
| 48 | { tags: ["provider:aws", "provider:aws:ec2", "live"] }, |
| 49 | ); |