#!/usr/bin/env bash

SLEEP=0.5

set -e
echo "" > coverage.txt

rm -f profile.out
for d in $(go list ./... | grep -v vendor); do
    go test -race -coverprofile=profile.out -covermode=atomic $d
    if [ -f profile.out ]; then
      cat profile.out >> coverage.txt
      rm profile.out
    fi
done


# Test if libs that require built in Goby script would work.
# TODO: Write a test for this specific case
go install .
goby test_fixtures/server.gb & PID=$!
echo "Sleeping $SLEEP sec for waiting server.gb being ready..."; sleep $SLEEP

ab -n 3000 -c 100 http://localhost:3000/

kill $PID

#!/usr/bin/env bash

set -e
echo "" > coverage.txt

for d in $(go list ./... | grep -v vendor); do
    go test -race -coverprofile=profile.out -covermode=atomic $d
    if [ -f profile.out ]; then
      cat profile.out >> coverage.txt
      rm profile.out
    fi
done


# Test if libs that require built in Goby script would work.
# TODO: Write a test for this specific case
go install .
goby test_fixtures/server.gb & PID=$!

ab -n 3000 -c 100 http://localhost:3000/

kill $PID
--- 
+++ 
@@ -1,8 +1,11 @@
 #!/usr/bin/env bash
+
+SLEEP=0.5
 
 set -e
 echo "" > coverage.txt
 
+rm -f profile.out
 for d in $(go list ./... | grep -v vendor); do
     go test -race -coverprofile=profile.out -covermode=atomic $d
     if [ -f profile.out ]; then
@@ -16,6 +19,7 @@
 # TODO: Write a test for this specific case
 go install .
 goby test_fixtures/server.gb & PID=$!
+echo "Sleeping $SLEEP sec for waiting server.gb being ready..."; sleep $SLEEP
 
 ab -n 3000 -c 100 http://localhost:3000/
 
Add sleep before apache bench to avoid 'connection refused' error

- Add 'rm -rf profile.out' for cleanup
