forked from phoenix/litellm-mirror
build(config.yml): output test results
This commit is contained in:
parent
4f87ba4200
commit
0e04e1fa56
1 changed files with 36 additions and 11 deletions
|
@ -135,22 +135,47 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Test the application
|
name: Test the application
|
||||||
command: |
|
command: |
|
||||||
status_codes=()
|
mkdir -p /tmp/responses
|
||||||
for i in {1..10}; do
|
for i in {1..10}; do
|
||||||
status=$(curl --location --request 'POST' 'http://0.0.0.0:4000/key/generate' \
|
status_file="/tmp/responses/status_${i}.txt"
|
||||||
--header 'Authorization: Bearer sk-1234' \
|
response_file="/tmp/responses/response_${i}.json"
|
||||||
--header 'Content-Type: application/json' \
|
|
||||||
--data '{"models": ["azure-models"], "aliases": {"mistral-7b": "gpt-3.5-turbo"}, "duration": null}' \
|
(curl --location --request 'POST' 'http://0.0.0.0:4000/key/generate' \
|
||||||
--silent --output /dev/null --write-out '%{http_code}\n') &
|
--header 'Authorization: Bearer sk-1234' \
|
||||||
status_codes+=($status)
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{"models": ["azure-models"], "aliases": {"mistral-7b": "gpt-3.5-turbo"}, "duration": null}' \
|
||||||
|
--silent --output "${response_file}" --write-out '%{http_code}' > "${status_file}") &
|
||||||
|
|
||||||
|
# Capture PIDs of background processes
|
||||||
|
pids[${i}]=$!
|
||||||
done
|
done
|
||||||
wait
|
|
||||||
for status in "${status_codes[@]}"; do
|
# Wait for all background processes to finish
|
||||||
if [[ "$status" -ne 200 ]]; then
|
for pid in ${pids[*]}; do
|
||||||
|
wait $pid
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check all responses and status codes
|
||||||
|
fail=false
|
||||||
|
for i in {1..10}; do
|
||||||
|
status=$(cat "/tmp/responses/status_${i}.txt")
|
||||||
|
response=$(cat "/tmp/responses/response_${i}.json")
|
||||||
|
|
||||||
|
echo "Response ${i} (Status code: ${status}):"
|
||||||
|
cat "${response}"
|
||||||
|
echo # Newline for readability
|
||||||
|
|
||||||
|
if [ "$status" -ne 200 ]; then
|
||||||
echo "A request did not return a 200 status code: $status"
|
echo "A request did not return a 200 status code: $status"
|
||||||
exit 1
|
fail=true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# If any request did not return status code 200, fail the job
|
||||||
|
if [ "$fail" = true ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "All requests returned a 200 status code."
|
echo "All requests returned a 200 status code."
|
||||||
|
|
||||||
publish_to_pypi:
|
publish_to_pypi:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue