forked from dokku-alt/dokku-alt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitreceive.bats
More file actions
34 lines (31 loc) · 1000 Bytes
/
gitreceive.bats
File metadata and controls
34 lines (31 loc) · 1000 Bytes
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
teardown() {
rm -rf /home/git
userdel git
}
@test "gitreceive init creates git user ready for pushes" {
gitreceive init
[[ -d /home/git ]]
[[ -f /home/git/.ssh/authorized_keys ]]
[[ -f /home/git/receiver ]]
[[ "git" == "$(ls -l /home/git/receiver | awk '{print $3}')" ]]
}
@test "gitreceive receiver script gets tar of pushed repo" {
gitreceive init
cat /root/.ssh/id_rsa.pub | ssh root@localhost "gitreceive upload-key test"
mkdir $BATS_TMPDIR/$BATS_TEST_NAME-push
chown git $BATS_TMPDIR/$BATS_TEST_NAME-push
cat <<EOF > /home/git/receiver
#!/bin/bash
tar -C $BATS_TMPDIR/$BATS_TEST_NAME-push -xf -
EOF
mkdir $BATS_TMPDIR/$BATS_TEST_NAME-repo
cd $BATS_TMPDIR/$BATS_TEST_NAME-repo
git init
echo "foobar" > contents
git add .
git commit -m 'only commit'
git remote add test git@localhost:test-$BATS_TEST_NUMBER
git push test master
[[ -f $BATS_TMPDIR/$BATS_TEST_NAME-push/contents ]]
[[ "foobar" == $(cat $BATS_TMPDIR/$BATS_TEST_NAME-push/contents) ]]
}