@reventlessdev/reventless-seed-aws 1.0.0-alpha.11 → 1.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/lib/bs/.compiler.log +2 -2
- package/lib/bs/compiler-info.json +1 -1
- package/lib/bs/src/ReventlessSeedAws_Quiesce.ast +0 -0
- package/lib/bs/src/ReventlessSeedAws_Quiesce.cmi +0 -0
- package/lib/bs/src/ReventlessSeedAws_Quiesce.cmj +0 -0
- package/lib/bs/src/ReventlessSeedAws_Quiesce.cmt +0 -0
- package/lib/bs/src/ReventlessSeedAws_Quiesce.res +287 -0
- package/lib/bs/src/ReventlessSeedAws_Quiesce.res.mjs +205 -0
- package/lib/bs/src/ReventlessSeedAws_Reconcile.ast +0 -0
- package/lib/bs/src/ReventlessSeedAws_Reconcile.cmi +0 -0
- package/lib/bs/src/ReventlessSeedAws_Reconcile.cmt +0 -0
- package/lib/bs/src/ReventlessSeedAws_Reconcile.res +2 -6
- package/lib/bs/src/ReventlessSeedAws_Reconcile.res.mjs +2 -2
- package/lib/bs/src/ReventlessSeedAws_Reset.ast +0 -0
- package/lib/bs/src/ReventlessSeedAws_Reset.cmi +0 -0
- package/lib/bs/src/ReventlessSeedAws_Reset.cmj +0 -0
- package/lib/bs/src/ReventlessSeedAws_Reset.cmt +0 -0
- package/lib/bs/src/ReventlessSeedAws_Reset.res +223 -73
- package/lib/bs/src/ReventlessSeedAws_Reset.res.mjs +212 -82
- package/lib/bs/tests/ObjectStoreReconcileTest.cmi +0 -0
- package/lib/bs/tests/ObjectStoreReconcileTest.cmt +0 -0
- package/lib/bs/tests/ObjectStoreResetTest.cmi +0 -0
- package/lib/bs/tests/ObjectStoreResetTest.cmt +0 -0
- package/lib/bs/tests/QuiesceResetTest.ast +0 -0
- package/lib/bs/tests/QuiesceResetTest.cmi +0 -0
- package/lib/bs/tests/QuiesceResetTest.cmj +0 -0
- package/lib/bs/tests/QuiesceResetTest.cmt +0 -0
- package/lib/bs/tests/QuiesceResetTest.res +133 -0
- package/lib/bs/tests/QuiesceResetTest.res.mjs +141 -0
- package/lib/ocaml/.compiler.log +2 -2
- package/lib/ocaml/ObjectStoreReconcileTest.cmi +0 -0
- package/lib/ocaml/ObjectStoreReconcileTest.cmt +0 -0
- package/lib/ocaml/ObjectStoreResetTest.cmi +0 -0
- package/lib/ocaml/ObjectStoreResetTest.cmt +0 -0
- package/lib/ocaml/QuiesceResetTest.ast +0 -0
- package/lib/ocaml/QuiesceResetTest.cmi +0 -0
- package/lib/ocaml/QuiesceResetTest.cmj +0 -0
- package/lib/ocaml/QuiesceResetTest.cmt +0 -0
- package/lib/ocaml/QuiesceResetTest.res +133 -0
- package/lib/ocaml/ReventlessSeedAws_Quiesce.ast +0 -0
- package/lib/ocaml/ReventlessSeedAws_Quiesce.cmi +0 -0
- package/lib/ocaml/ReventlessSeedAws_Quiesce.cmj +0 -0
- package/lib/ocaml/ReventlessSeedAws_Quiesce.cmt +0 -0
- package/lib/ocaml/ReventlessSeedAws_Quiesce.res +287 -0
- package/lib/ocaml/ReventlessSeedAws_Reconcile.ast +0 -0
- package/lib/ocaml/ReventlessSeedAws_Reconcile.cmi +0 -0
- package/lib/ocaml/ReventlessSeedAws_Reconcile.cmt +0 -0
- package/lib/ocaml/ReventlessSeedAws_Reconcile.res +2 -6
- package/lib/ocaml/ReventlessSeedAws_Reset.ast +0 -0
- package/lib/ocaml/ReventlessSeedAws_Reset.cmi +0 -0
- package/lib/ocaml/ReventlessSeedAws_Reset.cmj +0 -0
- package/lib/ocaml/ReventlessSeedAws_Reset.cmt +0 -0
- package/lib/ocaml/ReventlessSeedAws_Reset.res +223 -73
- package/package.json +4 -4
- package/src/ReventlessSeedAws_Quiesce.res +287 -0
- package/src/ReventlessSeedAws_Quiesce.res.mjs +205 -0
- package/src/ReventlessSeedAws_Reconcile.res +2 -6
- package/src/ReventlessSeedAws_Reconcile.res.mjs +2 -2
- package/src/ReventlessSeedAws_Reset.res +223 -73
- package/src/ReventlessSeedAws_Reset.res.mjs +212 -82
- package/tests/QuiesceResetTest.res +133 -0
- package/tests/QuiesceResetTest.res.mjs +141 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
4
|
+
import * as ReventlessSeedAws_Reset from "../src/ReventlessSeedAws_Reset.res.mjs";
|
|
5
|
+
import * as ReventlessSeedAws_Quiesce from "../src/ReventlessSeedAws_Quiesce.res.mjs";
|
|
6
|
+
import * as Seed_Client$ReventlessSeed from "@reventlessdev/reventless-seed/src/Seed_Client.res.mjs";
|
|
7
|
+
|
|
8
|
+
globalThis.describe("classify", () => {
|
|
9
|
+
globalThis.test("reads the function name out of a Lambda ARN", () => {
|
|
10
|
+
globalThis.expect(ReventlessSeedAws_Reset.classify("arn:aws:lambda:eu-west-1:123456789012:function:AllAutomationSlices-28b116c")).toEqual({
|
|
11
|
+
TAG: "Function",
|
|
12
|
+
_0: "AllAutomationSlices-28b116c"
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
globalThis.test("drops a version or alias qualifier", () => {
|
|
16
|
+
globalThis.expect(ReventlessSeedAws_Reset.classify("arn:aws:lambda:eu-west-1:123456789012:function:AllReadModels-0287438:42")).toEqual({
|
|
17
|
+
TAG: "Function",
|
|
18
|
+
_0: "AllReadModels-0287438"
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
globalThis.test("still classifies tables and buckets", () => {
|
|
22
|
+
globalThis.expect(ReventlessSeedAws_Reset.classify("arn:aws:dynamodb:eu-west-1:123456789012:table/Products-0ba6849")).toEqual({
|
|
23
|
+
TAG: "Table",
|
|
24
|
+
_0: "Products-0ba6849"
|
|
25
|
+
});
|
|
26
|
+
globalThis.expect(ReventlessSeedAws_Reset.classify("arn:aws:s3:::alpha-product-images")).toEqual({
|
|
27
|
+
TAG: "Bucket",
|
|
28
|
+
_0: "alpha-product-images"
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
globalThis.test("ignores anything else the tag scope returns", () => {
|
|
32
|
+
globalThis.expect(ReventlessSeedAws_Reset.classify("arn:aws:sqs:eu-west-1:123456789012:OrderingDcbCmdTopic-4b3658c")).toEqual("Other");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
globalThis.describe("mapBounded", () => {
|
|
37
|
+
globalThis.test("keeps results in input order under out-of-order completion", async () => {
|
|
38
|
+
let delays = [
|
|
39
|
+
40,
|
|
40
|
+
0,
|
|
41
|
+
30,
|
|
42
|
+
10,
|
|
43
|
+
20,
|
|
44
|
+
5
|
|
45
|
+
];
|
|
46
|
+
let out = await ReventlessSeedAws_Quiesce.mapBounded(delays, 3, async ms => {
|
|
47
|
+
await Seed_Client$ReventlessSeed.sleep(ms);
|
|
48
|
+
return ms;
|
|
49
|
+
});
|
|
50
|
+
globalThis.expect(out).toEqual(delays);
|
|
51
|
+
});
|
|
52
|
+
globalThis.test("never runs more than the limit at once", async () => {
|
|
53
|
+
let inFlight = {
|
|
54
|
+
contents: 0
|
|
55
|
+
};
|
|
56
|
+
let peak = {
|
|
57
|
+
contents: 0
|
|
58
|
+
};
|
|
59
|
+
await ReventlessSeedAws_Quiesce.mapBounded(Stdlib_Array.make(12, 0), 4, async param => {
|
|
60
|
+
inFlight.contents = inFlight.contents + 1 | 0;
|
|
61
|
+
peak.contents = Math.max(peak.contents, inFlight.contents);
|
|
62
|
+
await Seed_Client$ReventlessSeed.sleep(5);
|
|
63
|
+
inFlight.contents = inFlight.contents - 1 | 0;
|
|
64
|
+
});
|
|
65
|
+
globalThis.expect(peak.contents).toBe(4);
|
|
66
|
+
});
|
|
67
|
+
globalThis.test("an empty list spawns no workers and returns nothing", async () => {
|
|
68
|
+
let out = await ReventlessSeedAws_Quiesce.mapBounded([], 4, async x => x);
|
|
69
|
+
globalThis.expect(out.length).toBe(0);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
globalThis.describe("refillMessage", () => {
|
|
74
|
+
globalThis.test("names every store that came back, with its count", () => {
|
|
75
|
+
let message = ReventlessSeedAws_Reset.refillMessage([
|
|
76
|
+
[
|
|
77
|
+
"AutoShipOrderTodo-61f39a2",
|
|
78
|
+
12
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
"GeocodeCustomerAddressTodo-50d9488",
|
|
82
|
+
1
|
|
83
|
+
]
|
|
84
|
+
], 41);
|
|
85
|
+
globalThis.expect(message.includes("AutoShipOrderTodo-61f39a2")).toBe(true);
|
|
86
|
+
globalThis.expect(message.includes("GeocodeCustomerAddressTodo-50d9488")).toBe(true);
|
|
87
|
+
globalThis.expect(message.startsWith("13 item(s)/object(s) came back")).toBe(true);
|
|
88
|
+
});
|
|
89
|
+
globalThis.test("advises re-running only when the runtimes were held", () => {
|
|
90
|
+
let message = ReventlessSeedAws_Reset.refillMessage([[
|
|
91
|
+
"AutoShipOrderTodo-61f39a2",
|
|
92
|
+
12
|
|
93
|
+
]], 41);
|
|
94
|
+
globalThis.expect(message.includes("already in flight")).toBe(true);
|
|
95
|
+
globalThis.expect(message.includes("Re-running clears it")).toBe(true);
|
|
96
|
+
});
|
|
97
|
+
globalThis.test("refuses to advise re-running when the stack was not held", () => {
|
|
98
|
+
let message = ReventlessSeedAws_Reset.refillMessage([[
|
|
99
|
+
"AutoShipOrderTodo-61f39a2",
|
|
100
|
+
12
|
|
101
|
+
]], 0);
|
|
102
|
+
globalThis.expect(message.includes("re-running will not help".toLowerCase())).toBe(true);
|
|
103
|
+
globalThis.expect(message.includes("SEED_RESET_NO_QUIESCE")).toBe(true);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
globalThis.describe("noQuiesce", () => {
|
|
108
|
+
let set = v => {
|
|
109
|
+
process.env["SEED_RESET_NO_QUIESCE"] = v;
|
|
110
|
+
};
|
|
111
|
+
globalThis.test("defaults to holding the platform", () => {
|
|
112
|
+
set("");
|
|
113
|
+
globalThis.expect(ReventlessSeedAws_Reset.noQuiesce()).toBe(false);
|
|
114
|
+
set("0");
|
|
115
|
+
globalThis.expect(ReventlessSeedAws_Reset.noQuiesce()).toBe(false);
|
|
116
|
+
set("no");
|
|
117
|
+
globalThis.expect(ReventlessSeedAws_Reset.noQuiesce()).toBe(false);
|
|
118
|
+
});
|
|
119
|
+
globalThis.test("accepts the spellings an operator would actually type", () => {
|
|
120
|
+
[
|
|
121
|
+
"1",
|
|
122
|
+
"true",
|
|
123
|
+
"TRUE",
|
|
124
|
+
" yes "
|
|
125
|
+
].forEach(v => {
|
|
126
|
+
set(v);
|
|
127
|
+
globalThis.expect(ReventlessSeedAws_Reset.noQuiesce()).toBe(true);
|
|
128
|
+
});
|
|
129
|
+
set("");
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
let Reset;
|
|
134
|
+
|
|
135
|
+
let Quiesce;
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
Reset,
|
|
139
|
+
Quiesce,
|
|
140
|
+
}
|
|
141
|
+
/* Not a pure module */
|