1import * as AWS from "@/AWS";
2import { EIP } from "@/AWS/EC2";
3import * as Provider from "@/Provider";
4import * as Test from "@/Test/Alchemy";
5import { expect } from "alchemy-test";
6import * as Effect from "effect/Effect";
7import { MinimumLogLevel } from "effect/References";
8import { assertEipGone } from "./Gone.ts";
9
10const { test } = Test.make({ providers: AWS.providers() });
11
12const logLevel = Effect.provideService(
13 MinimumLogLevel,
14 process.env.DEBUG ? "Debug" : "Info",
15);
16
17test.provider(
18 "list enumerates the deployed EIP",
19 (stack) =>
20 Effect.gen(function* () {
21 yield* stack.destroy();
22
23 const deployed = yield* stack.deploy(
24 Effect.gen(function* () {
25 return yield* EIP("ListEIP", {});
26 }),
27 );
28
29 const provider = yield* Provider.findProvider(EIP);
30 const all = yield* provider.list();
31
32 expect(all.some((x) => x.allocationId === deployed.allocationId)).toBe(
33 true,
34 );
35
36 yield* stack.destroy();
37
38 yield* assertEipGone(deployed.allocationId);
39 }).pipe(logLevel),
40 { tags: ["provider:aws", "provider:aws:ec2", "live"] },
41);