Skip to content
Snippets Groups Projects
Commit 620730dd0f5d authored by Dan Villiom Podlaski Christiansen's avatar Dan Villiom Podlaski Christiansen
Browse files

tests: add anonymous HTTP test using dulwich.web

parent 5cb91e8a6b4f
No related branches found
No related tags found
1 merge request!127Remove some unnecessary caching
#require serve
Check cloning a Git repository over anonymous HTTP, served up by
Dulwich. The script uses `os.fork()`, so this doesn't work on Windows.
Load commonly used test logic
$ . "$TESTDIR/testutil"
......@@ -13,9 +16,6 @@
$ echo bar > bar
$ git add bar
$ fn_git_commit -m test
$ git daemon --listen=localhost --port=$HGPORT \
> --pid-file=$DAEMON_PIDS --detach --export-all --verbose \
> --base-path=$TESTTMP \
> || exit 80
$ $PYTHON $TESTDIR/testlib/dulwich-serve.py --port=$HGPORT
$ cd ..
......@@ -20,4 +20,4 @@
$ cd ..
Make sure that clone over the old git protocol doesn't break
Make sure that clone over unauthenticated HTTP doesn't break
......@@ -23,6 +23,6 @@
$ hg clone -U git://localhost:$HGPORT/test copy 2>&1
$ hg clone -U git+http://localhost:$HGPORT copy 2>&1
importing git objects into hg
$ hg log -T 'HG:{node|short} GIT:{gitnode|short}\n' -R copy
HG:221dd250e933 GIT:3af9773036a9
HG:c4d188f6e13d GIT:b23744d34f97
......@@ -25,4 +25,26 @@
importing git objects into hg
$ hg log -T 'HG:{node|short} GIT:{gitnode|short}\n' -R copy
HG:221dd250e933 GIT:3af9773036a9
HG:c4d188f6e13d GIT:b23744d34f97
$ cd copy
$ hg up master
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark master)
$ echo baz > baz
$ fn_hg_commit -A -m baz
$ hg push
pushing to git+http://localhost:$HGPORT/
searching for changes
adding objects
added 1 commits with 1 trees and 1 blobs
updating reference refs/heads/master
$ hg log -T 'HG:{node|short} GIT:{gitnode|short}\n' -r .
HG:daf1ae153bf8 GIT:ab88565d0614
Prevent the test from hanging:
$ cat $DAEMON_PIDS | xargs kill
(As an aside, don't use `pkill -F` -- that doesn't work and causes a
hang on Alpine.)
#!/usr/bin/env python3
#
# Wrapper for dulwich.web that forks a web server in a subprocess and
# saves the PID.
#
import os
import subprocess
import sys
proc = subprocess.Popen(
[
sys.executable,
"-m",
"dulwich.web",
] + sys.argv[1:],
stderr=subprocess.DEVNULL,
)
with open(os.getenv("DAEMON_PIDS"), "a") as fp:
fp.write("%d\n" % proc.pid)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment