Skip to content

Commit

Permalink
Merge pull request #308 from linkernetworks/johnlin/bats-wait-server
Browse files Browse the repository at this point in the history
[Hot-fix] waiting server startup
  • Loading branch information
John-Lin authored Sep 1, 2018
2 parents 6233407 + ffd8bb2 commit 1f0b638
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ src.test-coverage-vagrant:
src.test-bats:
sed -i.bak "s/localhost:9090/$$(minikube ip):30003/g; s/localhost:27017/$$(minikube ip):31717/g" config/testing.json
./build/src/cmd/vortex/vortex -config config/testing.json -port 7890 &
@echo "Waiting for server startup"
sleep 1
@cd tests;\
./test.sh

Expand Down
11 changes: 11 additions & 0 deletions tests/00-environement/00-env.bats
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,14 @@
showmount -e | grep /nfsshare ; echo $?
[ $? = 0 ]
}

@test "Waiting vortex server startup" {
NEXT_WAIT_COUNT=0
WAIT_LIMIT=5
until http -hd 127.0.0.1:7890/v1/version 2>&1 | grep HTTP/ || [ $NEXT_WAIT_COUNT -eq $WAIT_LIMIT ]; do
echo "Waiting server startup"
sleep 0.4
NEXT_WAIT_COUNT=$((NEXT_WAIT_COUNT+ 1))
done
[ $NEXT_WAIT_COUNT != $WAIT_LIMIT ]
}

0 comments on commit 1f0b638

Please sign in to comment.