Skip to content

Commit 0939916

Browse files
authored
Merge pull request #497 from fjtirado/Fix_http_flaky_test
Fix http flaky test
2 parents 1905651 + e4f04bf commit 0939916

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

impl/http/src/test/java/io/serverlessworkflow/impl/HTTPWorkflowDefinitionTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,16 @@ void testWrongSchema(String fileName) {
6262
.hasMessageContaining("There are JsonSchema validation errors");
6363
}
6464

65+
private static boolean httpCondition(Object obj) {
66+
Map<String, Object> map = (Map<String, Object>) obj;
67+
return map.containsKey("photoUrls") || map.containsKey("petId");
68+
}
69+
6570
private static Stream<Arguments> provideParameters() {
6671
Map<String, Object> petInput = Map.of("petId", 10);
6772
Map<String, Object> starTrekInput = Map.of("uid", "MOMA0000092393");
6873
Condition<Object> petCondition =
69-
new Condition<>(
70-
o -> ((Map<String, Object>) o).containsKey("photoUrls"), "callHttpCondition");
74+
new Condition<>(HTTPWorkflowDefinitionTest::httpCondition, "callHttpCondition");
7175
Condition<Object> starTrekCondition =
7276
new Condition<>(
7377
o ->

impl/http/src/test/resources/call-http-endpoint-interpolation.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ document:
44
name: call-http-shorthand-endpoint
55
version: '0.1.0'
66
do:
7-
- getPet:
8-
call: http
9-
with:
10-
headers:
11-
content-type: application/json
12-
method: get
13-
endpoint: ${ "https://petstore.swagger.io/v2/pet/\(.petId)" }
7+
- tryGetPet:
8+
try:
9+
- getPet:
10+
call: http
11+
with:
12+
headers:
13+
content-type: application/json
14+
method: get
15+
endpoint: ${ "https://petstore.swagger.io/v2/pet/\(.petId)" }
16+
catch:
17+
errors:
18+
with:
19+
type: https://serverlessworkflow.io/spec/1.0.0/errors/communication
20+
status: 404

0 commit comments

Comments
 (0)