| 1 | import * as AWS from "@/AWS"; |
| 2 | import { EIP } from "@/AWS/EC2"; |
| 3 | import * as Provider from "@/Provider"; |
| 4 | import * as Test from "@/Test/Alchemy"; |
| 5 | import { expect } from "alchemy-test"; |
| 6 | import * as Effect from "effect/Effect"; |
| 7 | import { MinimumLogLevel } from "effect/References"; |
| 8 | import { assertEipGone } from "./Gone.ts"; |
| 9 | |
| 10 | const { test } = Test.make({ providers: AWS.providers() }); |
| 11 | |
| 12 | const logLevel = Effect.provideService( |
| 13 | MinimumLogLevel, |
| 14 | process.env.DEBUG ? "Debug" : "Info", |
| 15 | ); |
| 16 | |
| 17 | test.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 | ); |