Skip to content

Commit

Permalink
replace startuptest
Browse files Browse the repository at this point in the history
  • Loading branch information
wy65701436 committed Mar 24, 2017
1 parent 74e7b66 commit 5f33b3f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ script:

- docker ps
- ./tests/notarytest.sh
- go run tests/startuptest.go https://localhost/
- ./tests/startuptest.sh
- go run tests/userlogintest.go -name ${HARBOR_ADMIN} -passwd ${HARBOR_ADMIN_PASSWD}

# - sudo ./tests/testprepare.sh
Expand Down
49 changes: 0 additions & 49 deletions tests/startuptest.go

This file was deleted.

28 changes: 28 additions & 0 deletions tests/startuptest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

set +e

TIMEOUT=12
while [ $TIMEOUT -gt 0 ]; do
STATUS=$(curl --insecure -s -o /dev/null -w '%{http_code}' https://localhost/)
if [ $STATUS -eq 200 ]; then
break
fi
TIMEOUT=$(($TIMEOUT - 1))
sleep 5
done

if [ $TIMEOUT -eq 0 ]; then
echo "Harbor cannot reach within one minute."
exit 1
fi

curl --insecure -s -L -H "Accept: application/json" https://localhost/ | grep "Harbor" > /dev/null
if [ $? -eq 0 ]; then
echo "Harbor is running success."
else
echo "Harbor is running fail."
exit 1
fi


0 comments on commit 5f33b3f

Please sign in to comment.