@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 113 lines 3.77 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { describe, expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as Kinesis from "@distilled.cloud/aws/kinesis";
5 import * as Provider from "alchemy/Provider";
6 import * as Effect from "effect/Effect";
7
8 const { test } = Test.make({ providers: AWS.providers() });
9
10 describe(
11 "AWS.Kinesis.StreamConsumer",
12 { tags: ["provider:aws", "provider:aws:kinesis", "live"] },
13 () => {
14 test.provider(
15 "create, update tags, and delete a stream consumer",
16 (stack) =>
17 Effect.gen(function* () {
18 const deployed = yield* stack.deploy(
19 Effect.gen(function* () {
20 const stream = yield* AWS.Kinesis.Stream("ConsumerSourceStream", {
21 streamMode: "PROVISIONED",
22 shardCount: 1,
23 });
24
25 const consumer = yield* AWS.Kinesis.StreamConsumer("AnalyticsConsumer", {
26 streamArn: stream.streamArn,
27 tags: { fixture: "consumer-test" },
28 });
29
30 return { stream, consumer };
31 }),
32 );
33
34 const description = yield* Kinesis.describeStreamConsumer({
35 ConsumerARN: deployed.consumer.consumerArn,
36 });
37 expect(description.ConsumerDescription.ConsumerStatus).toEqual("ACTIVE");
38
39 const initialTags = yield* Kinesis.listTagsForResource({
40 ResourceARN: deployed.consumer.consumerArn,
41 });
42 expect(initialTags.Tags).toContainEqual({ Key: "fixture", Value: "consumer-test" });
43
44 const updated = yield* stack.deploy(
45 Effect.gen(function* () {
46 const stream = yield* AWS.Kinesis.Stream("ConsumerSourceStream", {
47 streamMode: "PROVISIONED",
48 shardCount: 1,
49 });
50
51 const consumer = yield* AWS.Kinesis.StreamConsumer("AnalyticsConsumer", {
52 streamArn: stream.streamArn,
53 tags: { fixture: "consumer-test-updated", team: "platform" },
54 });
55
56 return { stream, consumer };
57 }),
58 );
59
60 const updatedTags = yield* Kinesis.listTagsForResource({
61 ResourceARN: updated.consumer.consumerArn,
62 });
63 expect(updatedTags.Tags).toContainEqual({
64 Key: "fixture",
65 Value: "consumer-test-updated",
66 });
67 expect(updatedTags.Tags).toContainEqual({ Key: "team", Value: "platform" });
68
69 yield* stack.destroy();
70
71 const deleted = yield* Kinesis.describeStreamConsumer({
72 ConsumerARN: updated.consumer.consumerArn,
73 }).pipe(
74 Effect.map(() => false),
75 Effect.catchTag("ResourceNotFoundException", () => Effect.succeed(true)),
76 );
77 expect(deleted).toBe(true);
78 }),
79 { timeout: 180_000 },
80 );
81
82 test.provider(
83 "list enumerates the deployed stream consumer",
84 (stack) =>
85 Effect.gen(function* () {
86 yield* stack.destroy();
87
88 const deployed = yield* stack.deploy(
89 Effect.gen(function* () {
90 const stream = yield* AWS.Kinesis.Stream("ListConsumerStream", {
91 streamMode: "PROVISIONED",
92 shardCount: 1,
93 });
94
95 const consumer = yield* AWS.Kinesis.StreamConsumer("ListConsumer", {
96 streamArn: stream.streamArn,
97 });
98
99 return { stream, consumer };
100 }),
101 );
102
103 const provider = yield* Provider.findProvider(AWS.Kinesis.StreamConsumer);
104 const all = yield* provider.list();
105
106 expect(all.some((c) => c.consumerArn === deployed.consumer.consumerArn)).toBe(true);
107
108 yield* stack.destroy();
109 }),
110 { timeout: 180_000 },
111 );
112 },
113 );