[PATCH] Add a test for git-daemon and clone via git:// protocol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The new test, t5703-daemon.sh, sets up a simple git-daemon at port 8111
(you can override it with the environment variable GIT_DAEMON_TEST_PORT),
and then tries to clone via git:// from it, first without the
git-daemon-export-ok file (which should fail), and then with it (which
should succeed).

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---


	On Sun, 10 Feb 2008, Johannes Schindelin wrote:

	> On Sat, 9 Feb 2008, Junio C Hamano wrote:
	> 
	> > Thanks.  The patch makes sense.
	> > 
	> > I wonder this deserves a new test case to protect the fix from 
	> > future regressions.
	> 
	> It would probably make sense; this would also exercise 
	> git-daemon for the first time in our test suite.

	How's this?

 t/t5703-daemon.sh |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100755 t/t5703-daemon.sh

diff --git a/t/t5703-daemon.sh b/t/t5703-daemon.sh
new file mode 100755
index 0000000..10696a1
--- /dev/null
+++ b/t/t5703-daemon.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+test_description='git daemon and cloning via git:// protocol'
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+
+	mkdir first &&
+	(cd first &&
+	 git init &&
+	 echo biomimicry > ted &&
+	 git add ted &&
+	 test_tick &&
+	 git commit -m initial &&
+	 git gc)
+
+'
+
+PORT=${GIT_DAEMON_TEST_PORT:-8111}
+
+start_daemon () {
+	trap 'kill "$DAEMON_PID"' 0
+	git daemon --base-path="$(pwd)" \
+		--port="$PORT" \
+		--detach \
+		--pid-file=pid-file \
+		-- "$(pwd)/first"
+	DAEMON_PID=$(cat pid-file)
+}
+
+test_expect_success 'daemon' '
+
+	start_daemon &&
+	test -f pid-file
+
+'
+
+test_expect_success 'clone fails without export-ok' '
+
+	! git clone git://127.0.0.1:"$PORT"/first second
+
+'
+
+test_expect_success 'clone succeeds with export-ok' '
+
+	: > first/.git/git-daemon-export-ok &&
+	git clone git://127.0.0.1:"$PORT"/first second &&
+	for f in refs/heads/master objects/pack/*.pack
+	do
+		cmp first/.git/$f second/.git/$f || break
+	done
+
+'
+
+test_done
-- 
1.5.4.1264.gb53928

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux