From 8f312302555526a5a3def21ccaba699b57d5a59b Mon Sep 17 00:00:00 2001 From: wy65701436 Date: Wed, 22 Mar 2017 04:30:20 -0700 Subject: [PATCH] add notary test --- .travis.yml | 1 + tests/notarytest.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 tests/notarytest.sh diff --git a/.travis.yml b/.travis.yml index e8c3500e8..b0dd4c556 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,6 +100,7 @@ script: - sudo make install GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage CLARITYIMAGE=danieljt/harbor-clarity-base:0.8.4 NOTARYFLAG=true - docker ps + - ./tests/notarytest.sh - go run tests/startuptest.go https://localhost/ - go run tests/userlogintest.go -name ${HARBOR_ADMIN} -passwd ${HARBOR_ADMIN_PASSWD} diff --git a/tests/notarytest.sh b/tests/notarytest.sh new file mode 100755 index 000000000..1f48f4449 --- /dev/null +++ b/tests/notarytest.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +TIMEOUT=10 +while [ $TIMEOUT -gt 0 ]; do + STATUS=$(curl -s -o /dev/null -w '%{http_code}' https://127.0.0.1/notary/v2/ -kv) + if [ $STATUS -eq 401 ]; then + echo "Notary is running success." + break + fi + TIMEOUT=$(($TIMEOUT - 1)) + sleep 5 +done + +if [ $TIMEOUT -eq 0 ]; then + echo "Notary is running fail." + exit 1 +fi \ No newline at end of file