t01-basic completed, some change to test.pm as well
This commit is contained in:
parent
56be906e5d
commit
dfccf1b0de
|
@ -27,6 +27,12 @@ use warnings;
|
|||
# required preamble for all tests
|
||||
try "
|
||||
DEF gsh = /TRACE: gsh.SOC=/
|
||||
DEF reject = /hook declined to update/; /remote rejected.*hook declined/; /error: failed to push some refs to/
|
||||
|
||||
DEF AP_1 = cd ../gitolite-admin; ok or die cant find admin repo clone;
|
||||
DEF AP_2 = AP_1; git add conf keydir; ok; git commit -m %1; ok; /master.* %1/
|
||||
DEF ADMIN_PUSH = AP_2 %1; glt push admin origin; ok; gsh; /master -> master/
|
||||
|
||||
./g3-install -c admin
|
||||
cd tsh_tempdir;
|
||||
";
|
||||
|
|
222
t/t01-basic
222
t/t01-basic
|
@ -10,9 +10,9 @@ use Gitolite::Test;
|
|||
# ----------------------------------------------------------------------
|
||||
|
||||
try "
|
||||
plan 74
|
||||
plan 213
|
||||
|
||||
## clone
|
||||
## subtest 1
|
||||
glt clone dev2 file://gitolite-admin
|
||||
!ok; gsh
|
||||
/DENIED by fallthru/
|
||||
|
@ -35,23 +35,19 @@ put "conf/gitolite.conf", "
|
|||
";
|
||||
|
||||
try "
|
||||
## push
|
||||
# push
|
||||
git add conf; ok
|
||||
git status -s; ok; /M conf/gitolite.conf/
|
||||
git commit -m t01a; ok; /master.*t01a/
|
||||
glt push dev2 origin; !ok; gsh
|
||||
/DENIED by fallthru/
|
||||
/fatal: The remote end hung up unexpectedly/
|
||||
glt push admin origin; ok; /master -. master/
|
||||
glt push admin origin; ok; /master -> master/
|
||||
tsh empty; ok;
|
||||
glt push admin origin master:mm
|
||||
!ok; gsh
|
||||
/DENIED by refs/heads/mm/
|
||||
/remote: error: hook declined to update refs/heads/mm/
|
||||
/To file://gitolite-admin/
|
||||
/remote rejected. master -. mm .hook declined./
|
||||
/error: failed to push some refs to 'file://gitolite-admin'/
|
||||
|
||||
reject
|
||||
";
|
||||
|
||||
put "conf/gitolite.conf", "
|
||||
|
@ -69,14 +65,10 @@ put "conf/gitolite.conf", "
|
|||
";
|
||||
|
||||
try "
|
||||
## push 2
|
||||
git add conf; ok
|
||||
git status -s; ok; /M conf/gitolite.conf/
|
||||
git commit -m t01b; ok; /master.*t01b/
|
||||
glt push admin origin; ok; gsh
|
||||
/master -. master/
|
||||
## subtest 2
|
||||
ADMIN_PUSH t01b
|
||||
|
||||
## clone
|
||||
# clone
|
||||
cd ..; ok;
|
||||
glt clone u1 file://t1; !ok; gsh
|
||||
/DENIED by fallthru/
|
||||
|
@ -86,25 +78,205 @@ try "
|
|||
ls -al t1; ok; /$ENV{USER}.*$ENV{USER}.*\.git/
|
||||
cd t1; ok;
|
||||
|
||||
## push
|
||||
# push
|
||||
test-commit tc1 tc2 tc2; ok; /f7153e3/
|
||||
glt push u2 origin; !ok; gsh
|
||||
/DENIED by fallthru/
|
||||
/fatal: The remote end hung up unexpectedly/
|
||||
glt push u3 origin master; ok; gsh
|
||||
/master -. master/
|
||||
/master -> master/
|
||||
|
||||
## rewind
|
||||
# rewind
|
||||
reset-h HEAD^; ok; /HEAD is now at 537f964 tc2/
|
||||
test-tick; test-commit tc3; ok; /a691552/
|
||||
glt push u3 origin; !ok; gsh
|
||||
/rejected.*master -. master.*non-fast-forward./
|
||||
/rejected.*master -> master.*non-fast-forward./
|
||||
glt push u3 -f origin; !ok; gsh
|
||||
reject
|
||||
/DENIED by fallthru/
|
||||
/remote: error: hook declined to update refs/heads/master/
|
||||
/To file://t1/
|
||||
/remote rejected. master -. master .hook declined./
|
||||
/error: failed to push some refs to 'file://t1'/
|
||||
glt push u4 origin +master; ok; gsh
|
||||
/ \\+ f7153e3...a691552 master -. master.*forced update./
|
||||
/ \\+ f7153e3...a691552 master -> master.*forced update./
|
||||
";
|
||||
|
||||
put "../gitolite-admin/conf/gitolite.conf", "
|
||||
\@admins = admin dev1
|
||||
repo gitolite-admin
|
||||
RW+ = admin
|
||||
|
||||
include 'i1.conf'
|
||||
";
|
||||
|
||||
put "../gitolite-admin/conf/i1.conf", "
|
||||
\@g1 = u1
|
||||
\@g2 = u2
|
||||
\@g3 = u3
|
||||
\@gaa = aa
|
||||
repo \@gaa
|
||||
RW+ = \@g1
|
||||
RW = \@g2
|
||||
RW+ master = \@g3
|
||||
RW master = u4
|
||||
- master = u5
|
||||
RW+ dev = u5
|
||||
RW = u5
|
||||
";
|
||||
|
||||
try "
|
||||
## subtest 3
|
||||
ADMIN_PUSH t01c
|
||||
|
||||
cd ..; ok
|
||||
";
|
||||
|
||||
try "
|
||||
glt clone u1 file://aa; ok; gsh
|
||||
cd aa; ok
|
||||
test-commit set3 t1 t2 t3 t4 t5 t6 t7 t8 t9
|
||||
ok
|
||||
glt push u1 origin HEAD; ok; gsh
|
||||
/To file://aa/
|
||||
/\\* \\[new branch\\] HEAD -> master/
|
||||
branch dev; ok
|
||||
branch foo; ok
|
||||
|
||||
# u1 rewind master ok
|
||||
reset-h HEAD^; ok
|
||||
test-commit r1; ok
|
||||
glt push u1 origin +master; ok; gsh
|
||||
/To file://aa/
|
||||
/\\+ cecf671...70469f5 master -> master .forced update./
|
||||
|
||||
# u2 rewind master !ok
|
||||
reset-h HEAD^; ok
|
||||
test-commit r2; ok
|
||||
glt push u2 origin +master; !ok; gsh
|
||||
reject
|
||||
/DENIED by fallthru/
|
||||
|
||||
# u3 rewind master ok
|
||||
reset-h HEAD^; ok
|
||||
test-commit r3; ok
|
||||
glt push u3 origin +master; ok; gsh
|
||||
/To file://aa/
|
||||
/\\+ 70469f5...f1e6821 master -> master .forced update./
|
||||
|
||||
# u4 push master ok
|
||||
test-commit u4; ok
|
||||
glt push u4 origin master; ok; gsh
|
||||
/To file://aa/
|
||||
/f1e6821..d308cfb +master -> master/
|
||||
|
||||
# u4 rewind master !ok
|
||||
reset-h HEAD^; ok
|
||||
glt push u4 origin +master; !ok; gsh
|
||||
reject
|
||||
/DENIED by fallthru/
|
||||
|
||||
# u3,u4 push other branches !ok
|
||||
glt push u3 origin dev; !ok; gsh
|
||||
reject
|
||||
/DENIED by fallthru/
|
||||
glt push u4 origin dev; !ok; gsh
|
||||
reject
|
||||
/DENIED by fallthru/
|
||||
glt push u3 origin foo; !ok; gsh
|
||||
reject
|
||||
/DENIED by fallthru/
|
||||
glt push u4 origin foo; !ok; gsh
|
||||
reject
|
||||
/DENIED by fallthru/
|
||||
|
||||
# clean up for next set
|
||||
glt push u1 -f origin master dev foo
|
||||
ok; gsh
|
||||
/d308cfb...f1e6821 master -> master .forced update./
|
||||
/new branch.*dev -> dev/
|
||||
/new branch.*foo -> foo/
|
||||
|
||||
# u5 push master !ok
|
||||
test-commit u5
|
||||
glt push u5 origin master; !ok; gsh
|
||||
reject
|
||||
/DENIED by refs/heads/master/
|
||||
|
||||
# u5 rewind dev ok
|
||||
glt push u5 origin +dev^:dev
|
||||
ok; gsh
|
||||
/\\+ cecf671...5c8a89d dev\\^ -> dev .forced update./
|
||||
|
||||
|
||||
# u5 rewind foo !ok
|
||||
glt push u5 origin +foo^:foo
|
||||
!ok; gsh
|
||||
reject
|
||||
/remote: FATAL: \\+ refs/heads/foo aa u5 DENIED by fallthru/
|
||||
|
||||
# u5 push foo ok
|
||||
git checkout foo
|
||||
/Switched to branch 'foo'/
|
||||
|
||||
test-commit u5
|
||||
glt push u5 origin foo; ok; gsh
|
||||
/cecf671..b27cf19 *foo -> foo/
|
||||
|
||||
# u1 delete dev ok
|
||||
glt push u1 origin :dev; ok; gsh
|
||||
/ - \\[deleted\\] *dev/
|
||||
|
||||
# push it back
|
||||
glt push u1 origin dev; ok; gsh
|
||||
/\\* \\[new branch\\] *dev -> dev/
|
||||
|
||||
";
|
||||
|
||||
put "| cat >> ../gitolite-admin/conf/gitolite.conf", "
|
||||
\@gr1 = r1
|
||||
repo \@gr1
|
||||
RW refs/heads/v[0-9] = u1
|
||||
RW refs/heads = tester
|
||||
";
|
||||
|
||||
try "
|
||||
## subtest 4
|
||||
ADMIN_PUSH t01d
|
||||
|
||||
cd ..; ok
|
||||
|
||||
glt clone tester file://r1; ok; gsh
|
||||
/Cloning into 'r1'.../
|
||||
cd r1; ok
|
||||
test-commit r1a r1b r1c r1d r1e r1f
|
||||
ok
|
||||
glt push tester origin HEAD;ok; gsh
|
||||
/\\* \\[new branch\\] *HEAD -> master/
|
||||
git branch v1
|
||||
glt push tester origin v1; ok; gsh
|
||||
/\\* \\[new branch\\] *v1 -> v1/
|
||||
|
||||
";
|
||||
|
||||
put "| cat >> ../gitolite-admin/conf/gitolite.conf", "
|
||||
\@gr2 = r2
|
||||
repo \@gr2
|
||||
RW refs/heads/v[0-9] = u1
|
||||
- refs/heads/v[0-9] = tester
|
||||
RW refs/heads = tester
|
||||
";
|
||||
|
||||
try "
|
||||
## subtest 5
|
||||
ADMIN_PUSH t01e
|
||||
|
||||
cd ..; ok
|
||||
|
||||
glt clone tester file://r2; ok; gsh
|
||||
/Cloning into 'r2'.../
|
||||
cd r2; ok
|
||||
test-commit r2a r2b r2c r2d r2e r2f
|
||||
ok
|
||||
glt push tester origin HEAD;ok; gsh
|
||||
/\\* \\[new branch\\] *HEAD -> master/
|
||||
git branch v1
|
||||
glt push tester origin v1; !ok; gsh
|
||||
/W refs/heads/v1 r2 tester DENIED by refs/heads/v\\[0-9\\]/
|
||||
"
|
||||
|
|
Loading…
Reference in a new issue