commit 2a58fc49f114494d86fc82b0a2d17836bc309174 from: Stefan Sperling via: Thomas Adam date: Thu Apr 25 14:57:36 2024 UTC add a basic HTTP test for 'got send', expecting failure commit - 7e73edb28e11c714302f015e9fd4f134a5115931 commit + 2a58fc49f114494d86fc82b0a2d17836bc309174 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