Permalink
Browse files

vref: tests

  • Loading branch information...
1 parent 56f975d commit b22aa284c38740c76037b86ffdaeaef27b361d77 @sitaramc committed Feb 25, 2012
Showing with 154 additions and 1 deletion.
  1. +1 −0 t/install
  2. +152 −0 t/t14-vrefs
  3. +1 −1 t/test-driver.sh
View
@@ -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
View
@@ -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
View
@@ -162,4 +162,4 @@ do
done
# this keeps changing as we add tests
-echo 1..3163
+echo 1..3459

0 comments on commit b22aa28

Please sign in to comment.