-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.sh
executable file
·67 lines (55 loc) · 1.29 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
VENV=`mktemp -d`
PKG=`ls dist/ | sort -n | head -1`
if [ ! -e dist/$PKG ]
then
echo "Unable to find package"
exit 1
fi
set -e
virtualenv --system-site-packages $VENV
pip install -E $VENV dist/$PKG
cd $VENV
source bin/activate
git init --bare test.git
htpasswd -cb .htpasswd test test
echo -e "[test.git]\ntest = rw\nanonymous = r" > .repoperms
ssh-keygen -f test_key -N ""
echo -n "test: " > .rsakeys
cat test_key.pub >> .rsakeys
gitserverglue &
DAEMON_PID=$!
# wait a bit to give gitserverglue a chance to start
sleep 5
git clone http://test:test@localhost:8080/test.git test_http
echo "hello world" > test_http/test.txt
cd test_http
git add test.txt
git commit -m "Test Commit"
git push origin master
cd ..
git clone git://localhost/test.git test_git
if [ ! -e test_git/test.txt ]
then
echo "[git://] Comitted file missing!!!"
kill $DAEMON_PID
exit 1
fi
ssh-agent bash -c 'ssh-add test_key; git clone ssh://test@localhost:5522/test.git test_ssh'
if [ ! -e test_ssh/test.txt ]
then
echo "[ssh://] Comitted file missing!!!"
kill $DAEMON_PID
exit 1
fi
echo "hi tester" >> test_ssh/test.txt
cd test_ssh
git add test.txt
git commit -m "foobar"
ssh-agent bash -c 'ssh-add ../test_key; git push'
cd ..
kill $DAEMON_PID
deactivate
rm -rf $VENV
echo ""
echo "Congrats, test.sh reached its end ;)"