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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,7 +14,8 @@ do
echo "
@leads = u1 u2
@devs = u1 u2 u3 u4
repo foo/CREATOR/.+
@gfoo = foo/CREATOR/.+
repo @gfoo
C = @leads
RW+ = CREATOR
" | ugc
@ -36,7 +37,9 @@ do
runlocal ssh u1 info
expect "hello u1, the gitolite version here is"
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"
runlocal ssh u1 expand

View file

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

View file

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