git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] http-push: add regression tests

From
Clemens Buchacher <drizzd@aon.at>
Date
Feb 23, 2008, 21:28 UTC
Message-ID
<20080223212843.GA30054@localhost>
In-Reply-To
<alpine.LSU.1.00.0802181733400.30505@racer.site>

These tests require a webserver. The executable path and listening port are configured using the environment variables

HTTPD_PATH (default: /usr/sbin/apache2) and HTTPD_PORT (default: 8111),

respectively.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
 t/t5540-http-push.sh |   97 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 97 insertions(+), 0 deletions(-)
 create mode 100644 t/t5540-http-push.sh
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
new file mode 100644
index 0000000..60210ff
--- /dev/null
+++ b/t/t5540-http-push.sh
@@ -0,0 +1,97 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
+#
+
+test_description='test http-push
+
+This test runs various sanity checks on http-push.'
+
+. ./test-lib.sh
+
+HTTPD_PATH=${HTTPD_PATH-'/usr/sbin/apache2'}
+HTTPD_PORT=${HTTPD_PORT-'8111'}
+
+if ! test -x "$HTTPD_PATH"
+then
+        test_expect_success 'skipping http-push tests, no suitable webserver' :
+        test_done
+        exit
+fi
+
+TRASH_PATH=$PWD
+
+start_httpd() {
+	cat > "$TRASH_PATH/httpd.conf" <<EOF
+ServerRoot "$TRASH_PATH"
+PidFile "$TRASH_PATH/httpd.pid"
+DocumentRoot "$TRASH_PATH"
+ErrorLog "$TRASH_PATH/error.log"
+Listen 127.0.0.1:$HTTPD_PORT
+LoadModule dav_module /usr/lib/apache2/modules/mod_dav.so
+LoadModule dav_fs_module /usr/lib/apache2/modules/mod_dav_fs.so
+DAVLockDB DAVLock
+<Location />
+	Dav on
+</Location>
+EOF
+
+	"$HTTPD_PATH" -f "$TRASH_PATH"/httpd.conf -k start
+}
+
+stop_httpd() {
+	"$HTTPD_PATH" -f "$TRASH_PATH"/httpd.conf -k stop
+}
+
+test_expect_success 'setup webserver' '
+	start_httpd
+'
+
+test_expect_success 'setup remote repository' '
+	cd "$TRASH_PATH" &&
+	mkdir test_repo &&
+	cd test_repo &&
+	git init &&
+	: >path1 &&
+	git add path1 &&
+	test_tick &&
+	git commit -m initial &&
+	cd - &&
+	git clone --bare test_repo test_repo.git &&
+	cd test_repo.git &&
+	git --bare update-server-info &&
+	chmod +x hooks/post-update
+'
+	
+test_expect_success 'clone remote repository' '
+	cd "$TRASH_PATH" &&
+	git clone http://127.0.0.1:$HTTPD_PORT/test_repo.git test_repo_clone
+'
+
+test_expect_success 'push to remote repository' '
+	cd "$TRASH_PATH"/test_repo_clone &&
+	: >path2 &&
+	git add path2 &&
+	test_tick &&
+	git commit -m path2 &&
+	git push
+'
+
+test_expect_success 'create and delete remote branch' '
+	cd "$TRASH_PATH"/test_repo_clone &&
+	git checkout -b dev &&
+	: >path3 &&
+	git add path3 &&
+	test_tick &&
+	git commit -m dev &&
+	git push origin dev &&
+	git fetch &&
+	git push origin :dev &&
+	git branch -d -r origin/dev &&
+	git fetch &&
+	! git show-ref --verify refs/remotes/origin/dev
+'
+
+stop_httpd
+
+test_done
-- 
1.5.4.2.156.ge3c5
Previous: Johannes SchindelinNext: Mike Hommey
Message 13 of 27 in “http-push: Fix error message for push <remote> :<branch>”
  1. http-push: Fix error message for push <remote> :<branch>Clemens Buchacher, Feb 18, 2008
  2. Johannes SchindelinFeb 18, 2008
  3. http-push: push <remote> :<branch> deletes remote branchClemens Buchacher, Feb 18, 2008
  4. http-push: push <remote> :<branch> deletes remote branchClemens Buchacher, Feb 18, 2008
  5. Johannes SchindelinFeb 18, 2008
  6. Johannes SchindelinFeb 18, 2008
  7. Clemens BuchacherFeb 19, 2008
  8. Johannes SchindelinFeb 19, 2008
  9. Mike HommeyFeb 19, 2008
  10. Johannes SchindelinFeb 19, 2008
  11. Junio C HamanoFeb 19, 2008
  12. Johannes SchindelinFeb 19, 2008
  13. http-push: add regression testsClemens Buchacher, Feb 23, 2008
  14. Mike HommeyFeb 24, 2008
  15. http-push: add regression testsClemens Buchacher, Feb 24, 2008
  16. Mike HommeyFeb 24, 2008
  17. Clemens BuchacherFeb 24, 2008
  18. http-push: add regression testsClemens Buchacher, Feb 25, 2008
  19. Junio C HamanoFeb 26, 2008
  20. http-push: add regression testsClemens Buchacher, Feb 27, 2008
  21. Mike HommeyFeb 27, 2008
  22. Johannes SchindelinFeb 27, 2008
  23. Clemens BuchacherFeb 27, 2008
  24. 1/2 http-push: push <remote> :<branch> deletes remote branchClemens Buchacher, Feb 27, 2008
  25. 2/2 http-push: add regression testsClemens Buchacher, Feb 27, 2008
  26. Johannes SchindelinFeb 27, 2008
  27. Mike HommeyFeb 26, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.