All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Buchacher <drizzd@aon.at>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: [PATCH] http-push: add regression tests
Date: Sat, 23 Feb 2008 22:28:44 +0100	[thread overview]
Message-ID: <20080223212843.GA30054@localhost> (raw)
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

  parent reply	other threads:[~2008-02-23 21:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-18 13:07 [PATCH] http-push: Fix error message for push <remote> :<branch> Clemens Buchacher
2008-02-18 13:45 ` Johannes Schindelin
2008-02-18 15:55   ` [PATCH] http-push: push <remote> :<branch> deletes remote branch Clemens Buchacher
2008-02-18 16:44     ` Clemens Buchacher
2008-02-18 17:35       ` Johannes Schindelin
2008-02-18 17:34     ` Johannes Schindelin
2008-02-19 12:58       ` Clemens Buchacher
2008-02-19 13:17         ` Johannes Schindelin
2008-02-19 13:24           ` Mike Hommey
2008-02-19 13:31             ` Johannes Schindelin
2008-02-19 21:35               ` Junio C Hamano
2008-02-19 22:25                 ` Johannes Schindelin
2008-02-23 21:28       ` Clemens Buchacher [this message]
2008-02-24  8:58         ` [PATCH] http-push: add regression tests Mike Hommey
2008-02-24 18:03           ` Clemens Buchacher
2008-02-24 18:48             ` Mike Hommey
2008-02-24 19:14               ` Clemens Buchacher
2008-02-25 23:28               ` Clemens Buchacher
2008-02-26  0:24                 ` Junio C Hamano
2008-02-27  8:54                   ` Clemens Buchacher
2008-02-27  9:16                     ` Mike Hommey
2008-02-27  9:51                     ` Johannes Schindelin
2008-02-27 19:23                       ` Clemens Buchacher
2008-02-27 19:27                         ` [PATCH 1/2] http-push: push <remote> :<branch> deletes remote branch Clemens Buchacher
2008-02-27 19:28                         ` [PATCH 2/2] http-push: add regression tests Clemens Buchacher
2008-02-27 22:24                         ` [PATCH] " Johannes Schindelin
2008-02-26 19:32                 ` Mike Hommey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080223212843.GA30054@localhost \
    --to=drizzd@aon.at \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.