Skip to content

Commit

Permalink
fix cli test
Browse files Browse the repository at this point in the history
  • Loading branch information
johzchen committed Feb 5, 2021
1 parent 8227624 commit 7be3fe4
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions api/test/shell/cli_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,30 @@ if [[ `grep -c "/apisix/admin/user/login" ./logs/access.log` -eq '0' ]]; then
exit 1
fi

# clean config
clean_up

# set ip allowed list
if [[ $KERNEL = "Darwin" ]]; then
sed -i "" 's@127.0.0.0/24@10.0.0.1@' conf/conf.yaml
else
sed -i 's@127.0.0.0/24@10.0.0.1@' conf/conf.yaml
fi

./manager-api &
sleep 3

# should be forbidden
curl http://127.0.0.1:9000
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9000)
if [ ! $code -eq 403 ]; then
echo "failed: verify IP allowed list failed"
exit 1
fi

./manager-api stop
clean_up


# etcd basic auth
# add root user
Expand Down Expand Up @@ -290,29 +314,4 @@ fi

./manager-api stop

# disable etcd auth
curl -L http://localhost:2379/v3/auth/disable -d '{"name": "root", "password": "root"}'

check_logfile
clean_up

# set ip allowed list
if [[ $KERNEL = "Darwin" ]]; then
sed -i "" 's@127.0.0.0/24@10.0.0.1@' conf/conf.yaml
else
sed -i 's@127.0.0.0/24@10.0.0.1@' conf/conf.yaml
fi

./manager-api &
sleep 3

# should be forbidden
curl http://127.0.0.1:9000
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9000)
if [ ! $code -eq 403 ]; then
echo "failed: verify IP allowed list failed"
exit 1
fi

./manager-api stop
clean_up

0 comments on commit 7be3fe4

Please sign in to comment.