Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@

APISIX_PACKAGE_NAME=apisix

APISIX_RUNTIME=1.3.2
APISIX_RUNTIME=1.3.3
APISIX_DASHBOARD_COMMIT=39be363cdbc5395d3163572c532be95f3dbad03a
2 changes: 1 addition & 1 deletion t/cli/test_ci_only.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ git checkout conf/config.yaml

mkdir /root/apisix

cp -r ./* /root/apisix
cp -R ./* /root/apisix
Copy link
Member Author

Choose a reason for hiding this comment

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

for lint fix:
image

cd /root/apisix
make init

Expand Down
52 changes: 47 additions & 5 deletions t/cli/test_load_full_data_init_worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,56 @@

. ./t/cli/common.sh

rm logs/error.log || true

git checkout conf/config.yaml

echo '
apisix:
worker_startup_time_threshold: 3
nginx_config:
worker_processes: 1
http_configuration_snippet: |
server {
listen 1980;
location /hello {
return 200 "hello world";
}
}
' > conf/config.yaml

make run

sleep 5

admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g')
curl -k -i http://127.0.0.1:9180/apisix/admin/routes/1 -H "X-API-KEY: $admin_key" -X PUT -d '
{
"uri": "/hello",
"upstream": {
"nodes": {
"127.0.0.1:1980": 1
},
"scheme": "http",
"type": "roundrobin"
}
}'

sleep 1

code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/hello)
if [ ! $code -eq 200 ]; then
echo "failed: request failed, http status $code"
exit 1
fi

MASTER_PID=$(cat logs/nginx.pid)

worker_pids=$(pgrep -P "$MASTER_PID" -f "nginx: worker process" || true)
worker_pid=$(pgrep -P "$MASTER_PID" -f "nginx: worker process" || true)

if [ -n "$worker_pids" ]; then
pid=$(echo "$worker_pids" | shuf -n 1)
echo "killing worker $pid (master $MASTER_PID)"
kill "$pid"
if [ -n "$worker_pid" ]; then
echo "killing worker $worker_pid (master $MASTER_PID)"
kill "$worker_pid"
else
echo "failed: no worker process found for master $MASTER_PID"
exit 1
Expand All @@ -50,6 +81,17 @@ if ! grep 'master process has been running for a long time, reloading the full c
exit 1
fi

if grep 'API disabled in the context of init_worker_by_lua' logs/error.log; then
echo "failed: cannot access etcd in init_worker phase"
exit 1
fi

code=$(curl -v -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/hello)
if [ ! $code -eq 200 ]; then
echo "failed: request failed for new worker, http status $code"
exit 1
fi

echo "passed: load full configuration for new worker"

make stop
Loading