Skip to content

Commit

Permalink
Add test case for command output in docker
Browse files Browse the repository at this point in the history
Signed-off-by: imjoey <[email protected]>
  • Loading branch information
imjoey committed Jan 29, 2021
1 parent 00fa584 commit 5c8259e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/deploy-with-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
Expand Down Expand Up @@ -38,6 +41,7 @@ jobs:
run: api/test/shell/docker_deploy_test.sh

- name: Deploy
if: ${{ github.event_name == 'push' }}
run: |
docker tag dashboard:ci apisixacr.azurecr.cn/dashboard:${{ github.sha }}
docker push apisixacr.azurecr.cn/dashboard:${{ github.sha }}
8 changes: 8 additions & 0 deletions api/test/shell/docker_deploy_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@

set -ex

# Version output
verline=$(docker logs docker-deploy_managerapi_1 | grep -E "^Version : [A-Za-z0-9\-\_\.]+")
if [ -z "$verline" ];then
echo "no Version output"
exit 1
fi

# web page
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)
Expand All @@ -32,6 +39,7 @@ resp=$(curl http://127.0.0.1:9000/apisix/admin/user/login -X POST -d '{"username
token=$(echo "${resp}" | sed 's/{/\n/g' | sed 's/,/\n/g' | grep "token" | sed 's/:/\n/g' | sed '1d' | sed 's/}//g' | sed 's/"//g')
if [ -z "${token}" ]; then
echo "login failed"
exit 1
fi

# plugin orchestration
Expand Down

0 comments on commit 5c8259e

Please sign in to comment.