Skip to content

Commit 0ec4f71

Browse files
committed
generate history files without time skipping, refactor test-helper
1 parent efcad5c commit 0ec4f71

File tree

57 files changed

+2648
-2081
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2648
-2081
lines changed

packages/aws-durable-execution-sdk-js-examples/scripts/generate-history.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { exampleStorage } from "../src/utils";
22
import fs from "fs";
33
import path from "path";
44
import { LocalDurableTestRunner } from "@aws/durable-execution-sdk-js-testing";
5-
import { ArgumentParser } from "argparse";
5+
import { ArgumentParser, BooleanOptionalAction } from "argparse";
66

77
async function main() {
88
const parser = new ArgumentParser({
@@ -19,9 +19,10 @@ async function main() {
1919
help: "Log the history events to the console",
2020
});
2121

22-
parser.add_argument("--no-skip-time", {
23-
action: "store_true",
24-
help: "Do not skip time in test environment (default: skip time)",
22+
parser.add_argument("--skip-time", {
23+
action: BooleanOptionalAction,
24+
help: "Enable skip time in test environment",
25+
default: true,
2526
});
2627

2728
parser.add_argument("--suffix", {
@@ -35,7 +36,7 @@ async function main() {
3536
});
3637

3738
parser.add_argument("--only-missing", {
38-
action: "store_true",
39+
action: BooleanOptionalAction,
3940
help: "Only add missing history files for the examples specified",
4041
default: true,
4142
});
@@ -44,7 +45,7 @@ async function main() {
4445

4546
const pattern = args.pattern;
4647
const logEvents = args.log;
47-
const skipTime = !args.no_skip_time;
48+
const skipTime = args.skip_time;
4849
const suffix = args.suffix;
4950
const onlyMissing = args.only_missing;
5051

@@ -77,7 +78,11 @@ async function main() {
7778

7879
const generated: string[] = [];
7980
for (const example of filteredExamples) {
80-
if (example.path.includes("callback") || !example.durableConfig) {
81+
if (
82+
example.path.includes("callback") ||
83+
example.path.includes("invoke") ||
84+
!example.durableConfig
85+
) {
8186
console.log("Skipping example", example.name);
8287
continue;
8388
}

packages/aws-durable-execution-sdk-js-examples/src/examples/block-example/block-example.history.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
{
33
"EventType": "ExecutionStarted",
44
"EventId": 1,
5-
"Id": "896c934c-599d-4e8e-abbc-94c14607fe31",
6-
"EventTimestamp": "2025-11-30T22:35:20.364Z",
5+
"Id": "ec1e8feb-0e24-4870-a740-cdb91b06501c",
6+
"EventTimestamp": "2025-12-03T22:57:07.710Z",
77
"ExecutionStartedDetails": {
88
"Input": {
99
"Payload": "{}"
@@ -16,7 +16,7 @@
1616
"EventId": 2,
1717
"Id": "c4ca4238a0b92382",
1818
"Name": "parent_block",
19-
"EventTimestamp": "2025-11-30T22:35:20.389Z",
19+
"EventTimestamp": "2025-12-03T22:57:07.716Z",
2020
"ContextStartedDetails": {}
2121
},
2222
{
@@ -25,7 +25,7 @@
2525
"EventId": 3,
2626
"Id": "ea66c06c1e1c05fa",
2727
"Name": "nested_step",
28-
"EventTimestamp": "2025-11-30T22:35:20.389Z",
28+
"EventTimestamp": "2025-12-03T22:57:07.716Z",
2929
"ParentId": "c4ca4238a0b92382",
3030
"StepStartedDetails": {}
3131
},
@@ -35,7 +35,7 @@
3535
"EventId": 4,
3636
"Id": "ea66c06c1e1c05fa",
3737
"Name": "nested_step",
38-
"EventTimestamp": "2025-11-30T22:35:20.389Z",
38+
"EventTimestamp": "2025-12-03T22:57:07.716Z",
3939
"ParentId": "c4ca4238a0b92382",
4040
"StepSucceededDetails": {
4141
"Result": {
@@ -50,7 +50,7 @@
5050
"EventId": 5,
5151
"Id": "98c6f2c2287f4c73",
5252
"Name": "nested_block",
53-
"EventTimestamp": "2025-11-30T22:35:20.410Z",
53+
"EventTimestamp": "2025-12-03T22:57:07.717Z",
5454
"ParentId": "c4ca4238a0b92382",
5555
"ContextStartedDetails": {}
5656
},
@@ -59,42 +59,42 @@
5959
"SubType": "Wait",
6060
"EventId": 6,
6161
"Id": "6151f5ab282d90e4",
62-
"EventTimestamp": "2025-11-30T22:35:20.412Z",
62+
"EventTimestamp": "2025-12-03T22:57:07.719Z",
6363
"ParentId": "98c6f2c2287f4c73",
6464
"WaitStartedDetails": {
6565
"Duration": 1,
66-
"ScheduledEndTimestamp": "2025-11-30T22:35:21.412Z"
66+
"ScheduledEndTimestamp": "2025-12-03T22:57:08.719Z"
67+
}
68+
},
69+
{
70+
"EventType": "InvocationCompleted",
71+
"EventId": 7,
72+
"EventTimestamp": "2025-12-03T22:57:07.771Z",
73+
"InvocationCompletedDetails": {
74+
"StartTimestamp": "2025-12-03T22:57:07.710Z",
75+
"EndTimestamp": "2025-12-03T22:57:07.771Z",
76+
"Error": {},
77+
"RequestId": "41787b19-d7ee-4aea-b701-7b3007bf5d64"
6778
}
6879
},
6980
{
7081
"EventType": "WaitSucceeded",
7182
"SubType": "Wait",
72-
"EventId": 7,
83+
"EventId": 8,
7384
"Id": "6151f5ab282d90e4",
74-
"EventTimestamp": "2025-11-30T22:35:20.413Z",
85+
"EventTimestamp": "2025-12-03T22:57:08.721Z",
7586
"ParentId": "98c6f2c2287f4c73",
7687
"WaitSucceededDetails": {
7788
"Duration": 1
7889
}
7990
},
80-
{
81-
"EventType": "InvocationCompleted",
82-
"EventId": 8,
83-
"EventTimestamp": "2025-11-30T22:35:20.414Z",
84-
"InvocationCompletedDetails": {
85-
"StartTimestamp": "2025-11-30T22:35:20.364Z",
86-
"EndTimestamp": "2025-11-30T22:35:20.414Z",
87-
"Error": {},
88-
"RequestId": "b7e7df21-fb7f-41af-8494-df9102d91821"
89-
}
90-
},
9191
{
9292
"EventType": "ContextSucceeded",
9393
"SubType": "RunInChildContext",
9494
"EventId": 9,
9595
"Id": "98c6f2c2287f4c73",
9696
"Name": "nested_block",
97-
"EventTimestamp": "2025-11-30T22:35:20.452Z",
97+
"EventTimestamp": "2025-12-03T22:57:08.723Z",
9898
"ParentId": "c4ca4238a0b92382",
9999
"ContextSucceededDetails": {
100100
"Result": {
@@ -108,7 +108,7 @@
108108
"EventId": 10,
109109
"Id": "c4ca4238a0b92382",
110110
"Name": "parent_block",
111-
"EventTimestamp": "2025-11-30T22:35:20.473Z",
111+
"EventTimestamp": "2025-12-03T22:57:08.724Z",
112112
"ContextSucceededDetails": {
113113
"Result": {
114114
"Payload": "{\"nestedStep\":\"nested step result\",\"nestedBlock\":\"nested block result\"}"
@@ -118,19 +118,19 @@
118118
{
119119
"EventType": "InvocationCompleted",
120120
"EventId": 11,
121-
"EventTimestamp": "2025-11-30T22:35:20.473Z",
121+
"EventTimestamp": "2025-12-03T22:57:08.724Z",
122122
"InvocationCompletedDetails": {
123-
"StartTimestamp": "2025-11-30T22:35:20.431Z",
124-
"EndTimestamp": "2025-11-30T22:35:20.473Z",
123+
"StartTimestamp": "2025-12-03T22:57:08.722Z",
124+
"EndTimestamp": "2025-12-03T22:57:08.724Z",
125125
"Error": {},
126-
"RequestId": "e6ce0e7d-b5b1-436a-940c-efd85e44eb19"
126+
"RequestId": "21a2b7fc-9b58-4957-ab15-eb555118008d"
127127
}
128128
},
129129
{
130130
"EventType": "ExecutionSucceeded",
131131
"EventId": 12,
132-
"Id": "896c934c-599d-4e8e-abbc-94c14607fe31",
133-
"EventTimestamp": "2025-11-30T22:35:20.473Z",
132+
"Id": "ec1e8feb-0e24-4870-a740-cdb91b06501c",
133+
"EventTimestamp": "2025-12-03T22:57:08.724Z",
134134
"ExecutionSucceededDetails": {
135135
"Result": {
136136
"Payload": "{\"nestedStep\":\"nested step result\",\"nestedBlock\":\"nested block result\"}"

0 commit comments

Comments
 (0)