gitolite/t/t05a-delegation
Sitaram Chamarty e139be927a new 'subconf' feature to explicitly do delegation
(includes HOSTNAME substitution feature also...)
2011-08-30 20:50:34 +05:30

96 lines
2.5 KiB
Plaintext

# vim: syn=sh:
cd $TESTDIR
$TESTDIR/rollback || die "rollback failed"
editrc GL_BIG_CONFIG $1
# ----------
name "INTERNAL"
echo "
# group your projects/repos however you want
@u1r = r1a r1b
@u2r = r2a r2b
@u3r = r3a r3b
# the admin repo access was probably like this to start with:
repo gitolite-admin
RW = u1 u2 u3
RW+ NAME/ = tester
RW NAME/conf/fragments/u1r = u1
RW NAME/conf/fragments/u2r = u2
RW NAME/conf/fragments/u3r = u3
" | ugc
notexpect ABORT
name "tester push frag u1r"
cd ~/gitolite-admin
mkdir -p conf/fragments
echo "
repo @u1r
RW+ = tester
" > conf/fragments/u1r.conf
ugc < /dev/null
expect "create mode 100644 conf/fragments/u1r.conf"
expect "remote: Initialized empty Git repository in $TEST_BASE_FULL/r1a.git/"
expect "To gitolite:gitolite-admin"
expect "master -> master"
name "u1 push frag u1r"
cd ~/gitolite-admin
echo "
repo @u1r
RW+ = u5
" > conf/fragments/u1r.conf
ugc u1 < /dev/null
expect "To u1:gitolite-admin"
expect "master -> master"
name "u2 push main conf fail"
cd ~/gitolite-admin
echo "
repo @u1r
RW+ = u6
" | ugc u2
expect "W NAME/conf/gitolite.conf gitolite-admin u2 DENIED by fallthru"
expect "To u2:gitolite-admin"
expect "\[remote rejected\] master -> master (hook declined)"
git reset --hard origin/master &>/dev/null
name "u2 push frag u1r fail"
cd ~/gitolite-admin
echo "
repo @u1r
RW+ = u6
" > conf/fragments/u1r.conf
ugc u2 < /dev/null
expect "remote: W NAME/conf/fragments/u1r.conf gitolite-admin u2 DENIED by fallthru"
expect "To u2:gitolite-admin"
expect "\[remote rejected\] master -> master (hook declined)"
git reset --hard origin/master &>/dev/null
name "u3 set perms for r2a fail"
cd ~/gitolite-admin
echo "
repo r2a
RW+ = u6
" > conf/fragments/u3r.conf
ugc u3 < /dev/null
expect "u3r.conf attempting to set access for r2a"
git reset --hard origin/master &>/dev/null
name "u3 add r2b to u3r fail"
cd ~/gitolite-admin
echo "
@u3r = r2b
repo @u3r
RW+ = u6
" > conf/fragments/u3r.conf
ugc u3 < /dev/null
[[ $1 == 0 ]] && expect "u3r.conf attempting to set access for r2b"
[[ $1 == 1 ]] && expect "u3r.conf attempting to set access for locally modified @u3r"
[[ $1 == 1 ]] && notexpect "u3r.conf attempting to set access for r2b"
[[ $1 == 0 ]] && notexpect "defining groups is not allowed inside fragments"
git reset --hard origin/master &>/dev/null
name INTERNAL