Skip to content

Commit b2677cc

Browse files
committed
Add e2e test for http handler
Tests for #135
1 parent 6d98f42 commit b2677cc

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test_e2e.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,5 +633,39 @@ remove_sync_container
633633
wait
634634
pass
635635

636+
# Test http handler
637+
testcase "http"
638+
# First sync
639+
echo "$TESTCASE 1" > "$REPO"/file
640+
expected_depth="1"
641+
git -C "$REPO" commit -qam "$TESTCASE 1"
642+
GIT_SYNC \
643+
--logtostderr \
644+
--v=5 \
645+
--repo="$REPO" \
646+
--depth="$expected_depth" \
647+
--root="$ROOT" \
648+
--http-bind=":8888" \
649+
--http-metrics \
650+
--http-pprof \
651+
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
652+
sleep 2
653+
# check that health endpoint is alive
654+
if [[ $(curl --write-out %{http_code} --silent --output /dev/null http://localhost:8888) -ne 200 ]] ; then
655+
fail "health endpoint failed"
656+
fi
657+
# check that the metrics endpoint exists
658+
if [[ $(curl --write-out %{http_code} --silent --output /dev/null http://localhost:8888/metrics) -ne 200 ]] ; then
659+
fail "metrics endpoint failed"
660+
fi
661+
# check that the pprof endpoint exists
662+
if [[ $(curl --write-out %{http_code} --silent --output /dev/null http://localhost:8888/debug/pprof/) -ne 200 ]] ; then
663+
fail "pprof endpoint failed"
664+
fi
665+
# Wrap up
666+
remove_sync_container
667+
wait
668+
pass
669+
636670
echo "cleaning up $DIR"
637671
rm -rf "$DIR"

0 commit comments

Comments
 (0)