Skip to content

Commit 2de8325

Browse files
committed
Stabilize streaming integration test
1 parent 8c9d7a9 commit 2de8325

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scripts/test-int.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ wait_for_file() {
2525
[ -s "$file" ]
2626
}
2727

28+
wait_for_payload() {
29+
payload=$1
30+
request_file=$2
31+
next_file=$3
32+
waits=${4:-200}
33+
while [ "$waits" -gt 0 ]; do
34+
if [ -f "$request_file" ] && grep -F "$payload" "$request_file" >/dev/null 2>&1; then
35+
return 0
36+
fi
37+
if [ -f "$next_file" ] && grep -F "$payload" "$next_file" >/dev/null 2>&1; then
38+
return 0
39+
fi
40+
sleep 0.1
41+
waits=$((waits - 1))
42+
done
43+
return 1
44+
}
45+
2846
ensure_image() {
2947
image=$1
3048
if ! docker image inspect "$image" >/dev/null 2>&1; then
@@ -458,6 +476,7 @@ API
458476
printf '%s\n' "Streaming response request was not captured" >&2
459477
exit 1
460478
fi
479+
wait_for_payload "$streaming_payload" "$streaming_request" "$streaming_next_request" 600 || true
461480

462481
streaming_request_clean=$(mktemp)
463482
{

0 commit comments

Comments
 (0)