lots of changes to tests for big-config

as well as wild, and (as much as I could) both together
This commit is contained in:
Sitaram Chamarty 2010-07-24 19:23:31 +05:30
parent f21e7780a1
commit 204b34e525
10 changed files with 271 additions and 118 deletions

View file

@ -5,7 +5,8 @@ echo "
@g1 = u1 @g1 = u1
@g2 = u2 @g2 = u2
@g3 = u3 @g3 = u3
repo aa @gaa = aa
repo @gaa
RW+ = @g1 RW+ = @g1
RW = @g2 RW = @g2
RW+ master = @g3 RW+ master = @g3
@ -116,7 +117,7 @@ expect " * \[new branch\] dev -> dev"
# u1 tries to delete dev on a new setup # u1 tries to delete dev on a new setup
name "INTERNAL" name "INTERNAL"
echo " echo "
repo aa repo @gaa
RWD dev = u4 RWD dev = u4
" | ugc " | ugc
expect "master -> master" expect "master -> master"
@ -135,7 +136,8 @@ expect " - \[deleted\] *dev"
name "INTERNAL" name "INTERNAL"
echo " echo "
repo r1 @gr1 = r1
repo @gr1
RW refs/heads/v[0-9] = u1 RW refs/heads/v[0-9] = u1
RW refs/heads = tester RW refs/heads = tester
" | ugc " | ugc
@ -155,7 +157,8 @@ expect "\* \[new branch\] v1 -> v1"
name "INTERNAL" name "INTERNAL"
echo " echo "
repo r2 @gr2 = r2
repo @gr2
RW refs/heads/v[0-9] = u1 RW refs/heads/v[0-9] = u1
- refs/heads/v[0-9] = tester - refs/heads/v[0-9] = tester
RW refs/heads = tester RW refs/heads = tester

View file

@ -7,7 +7,8 @@ echo "
@TAs = u2 u3 @TAs = u2 u3
@students = u4 u5 u6 @students = u4 u5 u6
repo foo/CREATOR/a[0-9][0-9] @gfoo = foo/CREATOR/a[0-9][0-9]
repo @gfoo
C = @all C = @all
RW+ = CREATOR RW+ = CREATOR
RW = WRITERS @TAs RW = WRITERS @TAs

View file

@ -7,7 +7,8 @@ echo "
@TAs = u2 u3 @TAs = u2 u3
@students = u4 u5 u6 @students = u4 u5 u6
repo foo/CREATOR/a[0-9][0-9] @gfoo = foo/CREATOR/a[0-9][0-9]
repo @gfoo
C = @students C = @students
RW+ = CREATOR RW+ = CREATOR
RW = WRITERS @TAs RW = WRITERS @TAs

View file

@ -11,7 +11,8 @@ do
name "INTERNAL" name "INTERNAL"
echo " echo "
@staff = u1 u2 u3 @staff = u1 u2 u3
repo foo/CREATOR/.+ @gfoo = foo/CREATOR/.+
repo @gfoo
C = u1 C = u1
RW+ = CREATOR RW+ = CREATOR
RW = WRITERS RW = WRITERS
@ -57,7 +58,8 @@ do
name "INTERNAL" name "INTERNAL"
echo " echo "
@staff = u1 u2 u3 @staff = u1 u2 u3
repo foo/CREATOR/.+ @gfoo = foo/CREATOR/.+
repo @gfoo
C = u1 C = u1
RW+ = CREATOR RW+ = CREATOR
- = @staff - = @staff

View file

@ -13,7 +13,8 @@ do
name "INTERNAL" name "INTERNAL"
echo " echo "
@staff = u1 u2 u3 u4 u5 u6 @staff = u1 u2 u3 u4 u5 u6
repo foo @gfoo = foo
repo @gfoo
RW+ = u1 u2 RW+ = u1 u2
RW+ personal/USER/ = u3 u4 RW+ personal/USER/ = u3 u4
RW temp = u5 u6 RW temp = u5 u6

View file

@ -14,7 +14,8 @@ do
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo foo @gfoo = foo
repo @gfoo
RW+C = @leads RW+C = @leads
RW+C personal/USER/ = @devs RW+C personal/USER/ = @devs
RW = @devs RW = @devs
@ -74,7 +75,8 @@ do
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo bar @gbar = bar
repo @gbar
RW+ = @leads RW+ = @leads
RW+ personal/USER/ = @devs RW+ personal/USER/ = @devs
RW = @devs RW = @devs

View file

@ -14,7 +14,8 @@ do
echo " echo "
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo foo/CREATOR/.+ @gfoo = foo/CREATOR/.+
repo @gfoo
C = @leads C = @leads
RW+ = CREATOR RW+ = CREATOR
" | ugc " | ugc
@ -36,7 +37,9 @@ do
runlocal ssh u1 info runlocal ssh u1 info
expect "hello u1, the gitolite version here is" expect "hello u1, the gitolite version here is"
expect "@R.*@W.*testing" expect "@R.*@W.*testing"
[ "$wr" = "1" ] && expect "C.*R.*W.*foo/u1/\\.\\+" [ "$wr" = "1" ] && [ "$bc" = "0" ] && expect "C.*R.*W.*foo/u1/\\.\\+"
[ "$wr" = "1" ] && [ "$bc" = "1" ] && notexpect "C.*R.*W.*foo/u1/\\.\\+"
[ "$wr" = "1" ] && [ "$bc" = "1" ] && expect "C.*@gfoo"
name "u1 expand" name "u1 expand"
runlocal ssh u1 expand runlocal ssh u1 expand

View file

@ -15,7 +15,8 @@ do
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo bar @gbar = bar
repo @gbar
RW+ = @leads RW+ = @leads
RW = @devs RW = @devs
config foo.bar = baz config foo.bar = baz
@ -38,7 +39,8 @@ do
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo bar @gbar = bar
repo @gbar
RW+ = @leads RW+ = @leads
RW = @devs RW = @devs
config foo.bar = baz config foo.bar = baz
@ -55,7 +57,8 @@ do
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo bar @gbar = bar
repo @gbar
RW+ = @leads RW+ = @leads
RW = @devs RW = @devs
config foo.bar = baz config foo.bar = baz
@ -73,7 +76,8 @@ do
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo bar @gbar = bar
repo @gbar
RW+ = @leads RW+ = @leads
RW = @devs RW = @devs
config foo.bar = config foo.bar =

View file

@ -1,126 +1,135 @@
# vim: syn=sh: # vim: syn=sh:
for gcw in 0 1 for bc in 0 1
do do
cd $TESTDIR for gcw in 0 1
$TESTDIR/rollback || die "rollback failed" do
cd $TESTDIR
$TESTDIR/rollback || die "rollback failed"
name INTERNAL name INTERNAL
editrc GL_WILDREPOS 1 editrc GL_WILDREPOS 1
echo "\$GL_GITCONFIG_WILD = $gcw;" | addrc editrc GL_BIG_CONFIG $bc
echo "\$GL_GITCONFIG_WILD = $gcw;" | addrc
# ---------- # ----------
name "fail to set foo.bar" name "fail to set foo.bar"
echo " echo "
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo bar/..* @gbar = bar/..*
C = @leads repo @gbar
RW+ = CREATOR C = @leads
RW = @leads RW+ = CREATOR
config foo.bar = baz RW = @leads
" | ugc config foo.bar = baz
expect "remote: git config foo.bar not allowed" " | ugc
expect "remote: git config foo.bar not allowed"
name "update rc file to allow foo.*" name "update rc file to allow foo.*"
catrc catrc
cp ~/1 ~/junk cp ~/1 ~/junk
perl -pi -e 's/GL_GITCONFIG_KEYS = ""/GL_GITCONFIG_KEYS = "foo\\\\..*"/' ~/junk perl -pi -e 's/GL_GITCONFIG_KEYS = ""/GL_GITCONFIG_KEYS = "foo\\\\..*"/' ~/junk
cat ~/junk | runremote dd of=.gitolite.rc cat ~/junk | runremote dd of=.gitolite.rc
catrc catrc
expect "GL_GITCONFIG_KEYS.*foo" expect "GL_GITCONFIG_KEYS.*foo"
name "ok to set foo.bar" name "ok to set foo.bar"
echo " echo "
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo bar/..* @gbar = bar/..*
C = @leads repo @gbar
RW+ = CREATOR C = @leads
RW = @leads RW+ = CREATOR
config foo.bar = baz RW = @leads
" | ugc -r config foo.bar = baz
[ "$gcw" = "0" ] && expect "remote: git config set for bar/..\* but \$GL_GITCONFIG_WILD not set" " | ugc -r
[ "$gcw" = "1" ] && notexpect "remote: git config set for bar/..\* but \$GL_GITCONFIG_WILD not set" [ "$gcw" = "0" ] && expect "remote: git config set for bar/..\* but \$GL_GITCONFIG_WILD not set"
notexpect "git config.*not allowed" [ "$gcw" = "1" ] && notexpect "remote: git config set for bar/..\* but \$GL_GITCONFIG_WILD not set"
expect_push_ok "master -> master" notexpect "git config.*not allowed"
expect_push_ok "master -> master"
[ "$gcw" = "0" ] && continue # the rest of these tests don't make sense now [ "$gcw" = "0" ] && continue # the rest of these tests don't make sense now
name "fail to set foobar.baz" name "fail to set foobar.baz"
echo " echo "
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo bar/..* @gbar = bar/..*
C = @leads repo @gbar
RW+ = CREATOR C = @leads
RW = @leads RW+ = CREATOR
config foo.bar = baz RW = @leads
config foobar.baz = ooka config foo.bar = baz
" | ugc -r config foobar.baz = ooka
expect "remote: git config foobar.baz not allowed" " | ugc -r
expect "remote: git config foobar.baz not allowed"
name "u1 create bar/try1" name "u1 create bar/try1"
runlocal git ls-remote u1:bar/try1 runlocal git ls-remote u1:bar/try1
expect "Initialized empty Git repository in /home/gitolite-test/repositories/bar/try1.git/" expect "Initialized empty Git repository in /home/gitolite-test/repositories/bar/try1.git/"
name "check u1 has foo.bar" name "check u1 has foo.bar"
runremote cat repositories/bar/try1.git/config runremote cat repositories/bar/try1.git/config
expect '^.foo' expect '^.foo'
expect 'bar = baz' expect 'bar = baz'
name "delete foo.bar" name "delete foo.bar"
echo " echo "
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo bar/..* @gbar = bar/..*
C = @leads repo @gbar
RW+ = CREATOR C = @leads
RW = @leads RW+ = CREATOR
config foo.bar = RW = @leads
" | ugc -r config foo.bar =
expect_push_ok "master -> master" " | ugc -r
expect_push_ok "master -> master"
name "check u1 doesnt have foo.bar" name "check u1 doesnt have foo.bar"
runremote cat repositories/bar/try1.git/config runremote cat repositories/bar/try1.git/config
expect '^.foo' # git leaves the section header behind expect '^.foo' # git leaves the section header behind
notexpect 'bar = baz' notexpect 'bar = baz'
name "u2 create bar/try2" name "u2 create bar/try2"
runlocal git ls-remote u2:bar/try2 runlocal git ls-remote u2:bar/try2
expect "Initialized empty Git repository in /home/gitolite-test/repositories/bar/try2.git/" expect "Initialized empty Git repository in /home/gitolite-test/repositories/bar/try2.git/"
name "check u2 doesnt have foo.bar" name "check u2 doesnt have foo.bar"
runremote cat repositories/bar/try2.git/config runremote cat repositories/bar/try2.git/config
notexpect '^.foo' # but not here, since this repo never had the key at all notexpect '^.foo' # but not here, since this repo never had the key at all
notexpect 'bar = baz' notexpect 'bar = baz'
name "add foo.frob retroactively" name "add foo.frob retroactively"
echo " echo "
@leads = u1 u2 @leads = u1 u2
@devs = u1 u2 u3 u4 @devs = u1 u2 u3 u4
repo bar/..* @gbar = bar/..*
C = @leads repo @gbar
RW+ = CREATOR C = @leads
RW = @leads RW+ = CREATOR
config foo.frob = nitz RW = @leads
" | ugc -r config foo.frob = nitz
expect_push_ok "master -> master" " | ugc -r
expect_push_ok "master -> master"
name "check u1 has foo.frob" name "check u1 has foo.frob"
runremote cat repositories/bar/try1.git/config runremote cat repositories/bar/try1.git/config
expect '^.foo' expect '^.foo'
expect 'frob = nitz' expect 'frob = nitz'
name "check u2 has foo.frob" name "check u2 has foo.frob"
runremote cat repositories/bar/try2.git/config runremote cat repositories/bar/try2.git/config
expect '^.foo' expect '^.foo'
expect 'frob = nitz' expect 'frob = nitz'
name INTERNAL name INTERNAL
done
done done

127
t/t58-daemon-gitweb-wild Normal file
View file

@ -0,0 +1,127 @@
# vim: syn=sh:
for bc in 0 1
do
cd $TESTDIR
$TESTDIR/rollback || die "rollback failed"
editrc GL_WILDREPOS 1
editrc GL_BIG_CONFIG $bc
# ----------
name "INTERNAL"
echo "
@leads = u1 u2
@devs = u1 u2 u3 u4
@gbar = bar/CREATOR/..*
repo @gbar
C = @leads
RW+ = @leads
RW = @devs
" | ugc
expect_push_ok "master -> master"
runlocal git ls-remote u1:bar/u1/try1
runremote ls -al repositories/bar/u1/try1.git/git-daemon-export-ok
expect "ls: cannot access repositories/bar/u1/try1.git/git-daemon-export-ok: No such file or directory"
runremote ls -al projects.list
expect "gitolite-test gitolite-test 12 .* projects.list"
runremote cat projects.list
expect "testing.git"
notexpect "bar/u1/try1.git"
name "add daemon access"
echo "
R = daemon
" | ugc
runremote ls -al repositories/bar/u1/try1.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try1.git/git-daemon-export-ok"
runremote ls -al projects.list
expect "gitolite-test gitolite-test 12 .* projects.list"
name "add one more repo"
runlocal git ls-remote u1:bar/u1/try2
runremote ls -al repositories/bar/u1/try2.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try2.git/git-daemon-export-ok"
runremote ls -al projects.list
expect "gitolite-test gitolite-test 12 .* projects.list"
runremote cat projects.list
expect "testing.git"
notexpect "bar/u1/try1.git"
notexpect "bar/u1/try2.git"
name "add descriptions for try1 and try3 and compile"
echo "
bar/u1/try1 = \"this is bar/u1/try1\"
bar/u1/try3 = \"this is bar/u1/try3\"
" | ugc
runremote ls -al projects.list
expect "gitolite-test gitolite-test 28 .* projects.list"
runremote cat projects.list
expect "testing.git"
expect "bar/u1/try1.git"
notexpect "bar/u1/try2.git"
notexpect "bar/u1/try3.git"
runremote cat repositories/bar/u1/try1.git/description
expect "this is bar/u1/try1"
name "add try3 project"
runlocal git ls-remote u1:bar/u1/try3
runremote ls -al repositories/bar/u1/try3.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try3.git/git-daemon-export-ok"
runremote ls -al projects.list
expect "gitolite-test gitolite-test 28 .* projects.list"
runremote cat projects.list
expect "testing.git"
expect "bar/u1/try1.git"
notexpect "bar/u1/try2.git"
notexpect "bar/u1/try3.git"
runremote cat repositories/bar/u1/try1.git/description
expect "this is bar/u1/try1"
runremote cat repositories/bar/u1/try3.git/description
expect "cat: repositories/bar/u1/try3.git/description: No such file or directory"
name "now compile and recheck try3 stuff"
echo "
" | ugc
runremote ls -al repositories/bar/u1/try3.git/git-daemon-export-ok
expect "gitolite-test gitolite-test .* repositories/bar/u1/try3.git/git-daemon-export-ok"
runremote ls -al projects.list
expect "gitolite-test gitolite-test 44 .* projects.list"
runremote cat projects.list
expect "testing.git"
expect "bar/u1/try1.git"
notexpect "bar/u1/try2.git"
expect "bar/u1/try3.git"
runremote cat repositories/bar/u1/try1.git/description
expect "this is bar/u1/try1"
runremote cat repositories/bar/u1/try3.git/description
expect "this is bar/u1/try3"
name "add owner for try2 and compile"
echo "
bar/u1/try2 \"owner2\" = \"this is bar/u1/try1\"
" | ugc
runremote cat repositories/bar/u1/try2.git/config
expect "\[gitweb\]"
expect "owner = owner2"
runremote ls -al projects.list
expect "gitolite-test gitolite-test 60 .* projects.list"
runremote cat projects.list
expect "bar/u1/try2.git"
name "add gitweb access to all"
echo "
repo @gbar
R = gitweb
" | ugc
expect_push_ok "master -> master"
runremote ls -al projects.list
expect "gitolite-test gitolite-test 60 .* projects.list"
runremote cat projects.list
expect "testing.git"
expect "bar/u1/try1.git"
expect "bar/u1/try2.git"
expect "bar/u1/try3.git"
name "INTERNAL"
done