Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ci/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ rerun_flaky_tests() {
FLUSH_ETCD=1 prove --timer -I./test-nginx/lib -I./ $(echo "$tests" | xargs)
}

fail_on_bailout() {
local test_output_file="$1"

# Check for bailout message in test output
if grep -q "Bailout called. Further testing stopped:" "$test_output_file"; then
echo "Error: Bailout detected in test output"
exit 1
fi
}
install_curl () {
CURL_VERSION="8.13.0"
wget -q https://github.com/stunnel/static-curl/releases/download/${CURL_VERSION}/curl-linux-x86_64-glibc-${CURL_VERSION}.tar.xz
Expand Down
1 change: 1 addition & 0 deletions ci/linux_openresty_common_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ script() {

# APISIX_ENABLE_LUACOV=1 PERL5LIB=.:$PERL5LIB prove -Itest-nginx/lib -r t
FLUSH_ETCD=1 TEST_EVENTS_MODULE=$TEST_EVENTS_MODULE prove --timer -Itest-nginx/lib -I./ -r $TEST_FILE_SUB_DIR | tee /tmp/test.result
fail_on_bailout /tmp/test.result
rerun_flaky_tests /tmp/test.result
}

Expand Down
1 change: 1 addition & 0 deletions ci/redhat-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ run_case() {
set_coredns
# run test cases
FLUSH_ETCD=1 TEST_EVENTS_MODULE=$TEST_EVENTS_MODULE prove --timer -Itest-nginx/lib -I./ -r ${TEST_FILE_SUB_DIR} | tee /tmp/test.result
fail_on_bailout /tmp/test.result
rerun_flaky_tests /tmp/test.result
}

Expand Down
19 changes: 19 additions & 0 deletions t/plugin/ai-proxy.openai-compatible.t
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,22 @@ passed
ngx.say(err)
return
end

local final_res = {}
while true do
local chunk, err = res.body_reader() -- will read chunk by chunk
if err then
core.log.error("failed to read response chunk: ", err)
break
end
if not chunk then
break
end
core.table.insert_tail(final_res, chunk)
end

ngx.print(#final_res .. final_res[6])
}
}
--- response_body_like eval
qr/6data: \[DONE\]\n\n/
25 changes: 2 additions & 23 deletions t/plugin/ai-rate-limiting.t
Original file line number Diff line number Diff line change
Expand Up @@ -891,19 +891,7 @@ passed
],
"ssl_verify": false
},
"ai-rate-limiting": {
"instances": [
{
"name": "openai-gpt3",
"limit": 50,
"time_window": 60
},
{
"name": "openai-gpt4",
"limit": 20,
"time_window": 60
}
]
"ai-rate-limiting": {"instances": [{"name": "openai-gpt3","limit": 50,"time_window": 60},{"name": "openai-gpt4","limit": 20,"time_window": 60}]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
},
"upstream": {
Expand Down Expand Up @@ -996,16 +984,7 @@ Authorization: Bearer token
],
"ssl_verify": false
},
"ai-rate-limiting": {
"limit": 20,
"time_window": 60,
"instances": [
{
"name": "openai-gpt3",
"limit": 50,
"time_window": 60
}
]
"ai-rate-limiting": {"limit": 20, "time_window": 60, "instances": [{"name": "openai-gpt3","limit": 50,"time_window": 60}]
}
},
"upstream": {
Expand Down
Loading