Skip to content

Commit 18f1cd5

Browse files
Add retry mechanism for Blocking Endpoint test in Quarkus-LangChain4j workflow
1 parent d675b91 commit 18f1cd5

1 file changed

Lines changed: 34 additions & 12 deletions

File tree

.github/workflows/integration-quarkus-langchain4j.yml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,41 @@ jobs:
169169
170170
# Step 6: Run test 1
171171
- name: Trigger Blocking Endpoint
172-
run: |
173-
# Trigger endpoint
174-
HTTP_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:$QUARKUS_PORT/chat/blocking)
175-
HTTP_RESPONSE_CODE="${HTTP_RESPONSE: -3}"
176-
HTTP_RESPONSE_BODY="$HTTP_RESPONSE%???}"
177-
178-
# Check response code
179-
if [ "$HTTP_RESPONSE_CODE" != "200" ]; then
180-
echo "ERROR: Blocking endpoint returned HTTP code $HTTP_RESPONSE_CODE"
172+
run: |
173+
MAX_ATTEMPTS=3
174+
ATTEMPT=1
175+
SUCCESS=false
176+
177+
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
178+
echo "Attempt $ATTEMPT of $MAX_ATTEMPTS for blocking endpoint..."
179+
180+
# Trigger endpoint
181+
HTTP_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:$QUARKUS_PORT/chat/blocking)
182+
HTTP_RESPONSE_CODE="${HTTP_RESPONSE: -3}"
183+
HTTP_RESPONSE_BODY="${HTTP_RESPONSE%???}"
184+
185+
# Check response code
186+
if [ "$HTTP_RESPONSE_CODE" = "200" ]; then
187+
echo "SUCCESS: Blocking endpoint returned HTTP code: $HTTP_RESPONSE_CODE"
188+
echo "HTTP Response body: $HTTP_RESPONSE_BODY"
189+
SUCCESS=true
190+
break
191+
else
192+
echo "Attempt $ATTEMPT failed: Blocking endpoint returned HTTP code $HTTP_RESPONSE_CODE"
193+
echo "Response body: $HTTP_RESPONSE_BODY"
194+
195+
if [ $ATTEMPT -lt $MAX_ATTEMPTS ]; then
196+
echo "Retrying in 2 seconds..."
197+
sleep 2
198+
fi
199+
fi
200+
201+
ATTEMPT=$((ATTEMPT + 1))
202+
done
203+
204+
if [ "$SUCCESS" = false ]; then
205+
echo "ERROR: Blocking endpoint failed after $MAX_ATTEMPTS attempts"
181206
exit 1
182-
else
183-
echo "SUCCESS: Blocking endpoint returned HTTP code: ${HTTP_RESPONSE: -3}"
184-
echo "HTTP Response body: $HTTP_RESPONSE_BODY"
185207
fi
186208

187209
# Step 7: Run test 2

0 commit comments

Comments
 (0)