aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaram@atc.tcs.com>2012-02-25 19:59:37 +0530
committerSitaram Chamarty <sitaram@atc.tcs.com>2012-02-26 09:04:30 +0530
commitb22aa284c38740c76037b86ffdaeaef27b361d77 (patch)
tree7aa096d195682b96f2d8db2c197a15ae3e30bc90
parentvref: code (diff)
downloadgitolite-gentoo-b22aa284c38740c76037b86ffdaeaef27b361d77.tar.gz
gitolite-gentoo-b22aa284c38740c76037b86ffdaeaef27b361d77.tar.bz2
gitolite-gentoo-b22aa284c38740c76037b86ffdaeaef27b361d77.zip
vref: tests
-rwxr-xr-xt/install1
-rw-r--r--t/t14-vrefs152
-rwxr-xr-xt/test-driver.sh2
3 files changed, 154 insertions, 1 deletions
diff --git a/t/install b/t/install
index 864c196..24b9200 100755
--- a/t/install
+++ b/t/install
@@ -42,6 +42,7 @@ git config --global user.email "tester@example.com"
# install it
cd gitolite
+cp contrib/VREF/* src
git describe --tags --long HEAD > conf/VERSION
# in case it is dirty
src/gl-system-install
diff --git a/t/t14-vrefs b/t/t14-vrefs
new file mode 100644
index 0000000..ce36f45
--- /dev/null
+++ b/t/t14-vrefs
@@ -0,0 +1,152 @@
+# vim: ft=sh:
+tsh pwd || die '## tsh not installed?'
+
+# note 'tc' is an abbreviation for 'test-commit' in tsh lingo
+
+for wr in 0 1
+do
+ for bc in 0 1
+ do
+ cd $TESTDIR
+ $TESTDIR/rollback || die "rollback failed"
+ editrc GL_WILDREPOS $wr
+ editrc GL_BIG_CONFIG $bc
+
+ # ----------
+
+ name "INTERNAL"
+ echo "
+ @gfoo = foo
+ @lead = u1
+ @dev2 = u2
+ @dev4 = u4
+ @devs = @dev2 @dev4 u6
+ repo @gfoo
+ RW+ = @lead @devs
+ - VREF/COUNT/2 = @dev2
+ - VREF/COUNT/4 = @dev4
+ - VREF/COUNT/3/NEWFILES = u6
+ - VREF/COUNT/6 = u6
+ " | ugc
+
+ name "setup"
+ cd ~/td
+ tsh "
+ ls -al foo; !ok; /cannot access foo: No such file or directory/
+ clone u1:foo; ok; /Cloning into/
+ /You appear to have cloned an empty/
+ "
+ cd foo
+ tsh "
+ ls -Al; ok; /\.git/
+ "
+
+ name "check VREF is not called for u1"
+ GL_BINDIR=`gl-query-rc GL_BINDIR`
+ mv $GL_BINDIR/gl-VREF-COUNT ~
+ tsh "
+ tc a1 a2 a3 a4 a5; ok; /aaf9e8e/
+ push-om; ok; /new branch.*master -. master/
+ !/can\'t find helper program for VREF/COUNT/
+ !/hook declined/
+ !/remote rejected/
+ "
+
+ name "check VREF is called for u2"
+ tsh "
+ tc b1; ok; /1f440d3/
+ git push u2:foo; !ok; /can\'t find helper program for VREF/COUNT/2/
+ /hook declined/
+ /remote rejected/
+ "
+
+ mv ~/gl-VREF-COUNT $GL_BINDIR
+ name "u2 adds 1 file"
+ tsh "
+ git push u2:foo; ok; /aaf9e8e..1f440d3.*master -. master/
+ "
+
+ name "u2 adds 2 files"
+ tsh "
+ tc b2 b3; ok; /c3397f7/
+ git push u2:foo; ok; /1f440d3..c3397f7.*master -. master/
+ "
+
+ name "u2 adds 3 files"
+ tsh "
+ tc c1 c2 c3; ok; /be242d7/
+ git push u2:foo; !ok; /W VREF/COUNT/2 foo u2 DENIED by VREF/COUNT/2/
+ /too many changed files in this push/
+ /hook declined/
+ /remote rejected/
+ "
+
+ name "u4 adds 3 files"
+ tsh "
+ git push u4:foo; ok; /c3397f7..be242d7.*master -. master/
+ "
+
+ name "u4 adds 4 files"
+ tsh "
+ tc d1 d2 d3 d4; ok; /88d80e2/
+ git push u4:foo; ok; /be242d7..88d80e2.*master -. master/
+ "
+
+ name "u4 adds 5 files"
+ tsh "
+ tc d5 d6 d7 d8 d9; ok; /e9c60b0/
+ git push u4:foo; !ok; /W VREF/COUNT/4 foo u4 DENIED by VREF/COUNT/4/
+ /too many changed files in this push/
+ /hook declined/
+ /remote rejected/
+ "
+
+ name "u1 pushes it all"
+ tsh "
+ git push; ok; /88d80e2..e9c60b0.*master -. master/
+ "
+
+ name "u6 updates 6 old files"
+ tsh "
+ test-tick
+ tc d1 d2 d3 d4 d5 d6
+ ok; /2773f0a/
+ git push u6:foo; ok; /e9c60b0..2773f0a.*master -. master/
+ tag six
+ "
+
+ name "u6 updates 7 old files"
+ tsh "
+ test-tick; test-tick
+ tc d1 d2 d3 d4 d5 d6 d7
+ ok; /98e01c5/
+ git push u6:foo; !ok; /W VREF/COUNT/6 foo u6 DENIED by VREF/COUNT/6/
+ /too many changed files in this push/
+ /hook declined/
+ /remote rejected/
+ reset-h six; ok; /HEAD is now at 2773f0a/
+ "
+
+ name "u6 creates 4 new and 2 old files"
+ tsh "
+ test-tick; test-tick
+ tc d1 d2 n1 n2 n3 n4
+ ok; /cf1e284/
+ git push u6:foo; !ok; /W VREF/COUNT/3/NEWFILES foo u6 DENIED by VREF/COUNT/3/NEWFILES/
+ /too many new files in this push/
+ /hook declined/
+ /remote rejected/
+ reset-h six; ok; /HEAD is now at 2773f0a/
+ "
+
+ name "u6 creates 3 new and 3 old files"
+ tsh "
+ test-tick; test-tick
+ tc d1 d2 d3 n1 n2 n3
+ ok; /7447dfe/
+ git push u6:foo; ok; /2773f0a..7447dfe.*master -. master/
+ "
+
+ name INTERNAL
+ done
+done
diff --git a/t/test-driver.sh b/t/test-driver.sh
index 926ba2f..b7088b2 100755
--- a/t/test-driver.sh
+++ b/t/test-driver.sh
@@ -162,4 +162,4 @@ do
done
# this keeps changing as we add tests
-echo 1..3163
+echo 1..3459