commit 3c7a82272c81f61ca8742b226ad872c890d64d94 from: Stefan Sperling date: Wed Apr 17 17:02:22 2024 UTC add a basic HTTP test for 'got send', expecting failure commit - d3bfa9a153550bf95a0017f1ff8827181280d640 commit + 3c7a82272c81f61ca8742b226ad872c890d64d94 blob - b6f1c50eac455d297c5c32b125224755880ec879 blob + e790e19cb5dfcd481bdc20e2f0f2afd698bcccee --- regress/cmdline/send.sh +++ regress/cmdline/send.sh @@ -1663,6 +1663,65 @@ EOF fi test_done "$testroot" 0 +} + +test_send_basic_http() { + local testroot=`test_init send_basic_http` + local testurl=http://127.0.0.1:$GOT_TEST_HTTP_PORT + local commit_id=`git_show_head $testroot/repo` + + timeout 5 ./http-server -p $GOT_TEST_HTTP_PORT $testroot \ + > $testroot/http-server.log & + + sleep 1 # server starts up + + got clone -q $testurl/repo $testroot/repo-clone + ret=$? + if [ $ret -ne 0 ]; then + echo "got clone command failed unexpectedly" >&2 + test_done "$testroot" "$ret" + return 1 + fi + cat > $testroot/repo/.git/got.conf </dev/null + tag_id=`got ref -r $testroot/repo -l | grep "^refs/tags/1.0" \ + | tr -d ' ' | cut -d: -f2` + + echo "modified alpha" > $testroot/repo/alpha + git -C $testroot/repo rm -q beta + (cd $testroot/repo && ln -s epsilon/zeta symlink) + git -C $testroot/repo add symlink + echo "new file alpha" > $testroot/repo/new + git -C $testroot/repo add new + git_commit $testroot/repo -m "modified alpha" + local commit_id2=`git_show_head $testroot/repo` + + got send -q -r $testroot/repo > $testroot/stdout 2> $testroot/stderr + ret=$? + if [ $ret -eq 0 ]; then + echo "got send command succeeded unexpectedly" >&2 + test_done "$testroot" "$ret" + return 1 + fi + + kill %1 + wait %1 # wait for http-server + + echo "got: http: feature not implemented" > $testroot/stderr.expected + cmp -s $testroot/stderr $testroot/stderr.expected + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/stderr.expected $testroot/stderr + fi + test_done "$testroot" "$ret" + } test_parseargs "$@" @@ -1681,3 +1740,4 @@ run_test test_send_and_fetch_config run_test test_send_config run_test test_send_gitconfig run_test test_send_rejected +run_test test_send_basic_http