@@ -658,9 +658,9 @@ assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
658658pass
659659
660660# #############################################
661- # Test webhook
661+ # Test webhook success
662662# #############################################
663- testcase " webhook"
663+ testcase " webhook-success "
664664freencport
665665# First sync
666666echo " $TESTCASE 1" > " $REPO " /file
@@ -671,6 +671,7 @@ GIT_SYNC \
671671 --repo=" file://$REPO " \
672672 --root=" $ROOT " \
673673 --webhook-url=" http://127.0.0.1:$NCPORT " \
674+ --webhook-success-status=200 \
674675 --dest=" link" \
675676 > " $DIR " /log." $TESTCASE " 2>&1 &
676677# check that basic call works
700701# Wrap up
701702pass
702703
704+ # #############################################
705+ # Test webhook fire-and-forget
706+ # #############################################
707+ testcase " webhook-fire-and-forget"
708+ freencport
709+ # First sync
710+ echo " $TESTCASE 1" > " $REPO " /file
711+ git -C " $REPO " commit -qam " $TESTCASE 1"
712+ GIT_SYNC \
713+ --logtostderr \
714+ --v=5 \
715+ --repo=" file://$REPO " \
716+ --root=" $ROOT " \
717+ --webhook-url=" http://127.0.0.1:$NCPORT " \
718+ --webhook-success-status=-1 \
719+ --dest=" link" \
720+ > " $DIR " /log." $TESTCASE " 2>&1 &
721+ # check that basic call works
722+ { (echo -e " HTTP/1.1 404 Not Found\r\n" | nc -q1 -l $NCPORT > /dev/null) & }
723+ NCPID=$!
724+ sleep 3
725+ if kill -0 $NCPID > /dev/null 2>&1 ; then
726+ fail " webhook 1 not called, server still running"
727+ fi
728+ # Wrap up
729+ pass
730+
703731# #############################################
704732# Test http handler
705733# #############################################
0 commit comments