@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 60 lines 1.92 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { NetworkAcl, NetworkAclEntry, 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 Network ACL Entry",
16 (stack) =>
17 Effect.gen(function* () {
18 yield* stack.destroy();
19
20 const { vpc, entry } = yield* stack.deploy(
21 Effect.gen(function* () {
22 const vpc = yield* Vpc("ListNaclEntryVpc", {
23 cidrBlock: "10.0.0.0/16",
24 });
25 const acl = yield* NetworkAcl("ListNaclEntryAcl", {
26 vpcId: vpc.vpcId,
27 });
28 const entry = yield* NetworkAclEntry("ListNaclEntry", {
29 networkAclId: acl.networkAclId,
30 ruleNumber: 100,
31 protocol: "6",
32 ruleAction: "allow",
33 egress: false,
34 cidrBlock: "0.0.0.0/0",
35 portRange: { from: 443, to: 443 },
36 });
37 return { vpc, acl, entry };
38 }),
39 );
40
41 const provider = yield* Provider.findProvider(NetworkAclEntry);
42 const all = yield* provider.list();
43
44 expect(
45 all.some(
46 (x) =>
47 x.networkAclId === entry.networkAclId &&
48 x.ruleNumber === entry.ruleNumber &&
49 x.egress === entry.egress,
50 ),
51 ).toBe(true);
52
53 yield* stack.destroy();
54
55 // The VPC cannot delete while the ACL (and its entries) exists — VPC-gone
56 // proves full teardown.
57 yield* assertVpcGone(vpc.vpcId);
58 }).pipe(logLevel),
59 { tags: ["provider:aws", "provider:aws:ec2", "live"] },
60 );