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 { EgressOnlyInternetGateway, 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 { 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 Egress-Only Internet Gateway", |
| 16 | (stack) => |
| 17 | Effect.gen(function* () { |
| 18 | yield* stack.destroy(); |
| 19 | |
| 20 | const { vpc, eigw } = yield* stack.deploy( |
| 21 | Effect.gen(function* () { |
| 22 | const vpc = yield* Vpc("ListEigwVpc", { cidrBlock: "10.0.0.0/16" }); |
| 23 | const eigw = yield* EgressOnlyInternetGateway("ListEigw", { vpcId: vpc.vpcId }); |
| 24 | return { vpc, eigw }; |
| 25 | }), |
| 26 | ); |
| 27 | |
| 28 | const provider = yield* Provider.findProvider(EgressOnlyInternetGateway); |
| 29 | const all = yield* provider.list(); |
| 30 | |
| 31 | expect( |
| 32 | all.some((x) => x.egressOnlyInternetGatewayId === eigw.egressOnlyInternetGatewayId), |
| 33 | ).toBe(true); |
| 34 | |
| 35 | yield* stack.destroy(); |
| 36 | |
| 37 | // The VPC cannot delete while the egress-only IGW exists, so VPC-gone |
| 38 | // proves the whole stack (EIGW included) was torn down. |
| 39 | yield* assertVpcGone(vpc.vpcId); |
| 40 | }).pipe(logLevel), |
| 41 | { tags: ["provider:aws", "provider:aws:ec2", "live"] }, |
| 42 | ); |