~ubuntu-branches/ubuntu/utopic/gitolite3/utopic-proposed

« back to all changes in this revision

Viewing changes to t/deleg-1.t

  • Committer: Package Import Robot
  • Author(s): David Bremner
  • Date: 2013-05-18 17:59:21 UTC
  • Revision ID: package-import@ubuntu.com-20130518175921-ac4xe6vd0jtxvjot
Tags: upstream-3.5.1+4
ImportĀ upstreamĀ versionĀ 3.5.1+4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
use strict;
 
3
use warnings;
 
4
 
 
5
# this is hardcoded; change it if needed
 
6
use lib "src/lib";
 
7
use Gitolite::Test;
 
8
 
 
9
# delegation tests -- part 1
 
10
# ----------------------------------------------------------------------
 
11
 
 
12
try "plan 53";
 
13
 
 
14
try "
 
15
    DEF SP_1 = git add conf ; ok; git commit -m %1; ok; /master.* %1/
 
16
    DEF SUBCONF_PUSH = SP_1 %2; glt push %1 origin; gsh; /master -> master/
 
17
";
 
18
 
 
19
confreset;confadd '
 
20
    @u1r    =   r1a r1b
 
21
    @u2r    =   r2a r2b
 
22
    @u3r    =   r3a r3b
 
23
 
 
24
    # the admin repo access was probably like this to start with:
 
25
    repo gitolite-admin
 
26
        RW                              = u1 u2 u3
 
27
        RW+ NAME/                       = admin
 
28
        RW  NAME/conf/fragments/u1r     = u1
 
29
        RW  NAME/conf/fragments/u2r     = u2
 
30
        RW  NAME/conf/fragments/u3r     = u3
 
31
        -   NAME/                       = @all
 
32
 
 
33
        subconf "fragments/*.conf"
 
34
';
 
35
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
36
 
 
37
mkdir "conf/fragments";
 
38
put   "conf/fragments/u1r.conf", '
 
39
    repo @u1r
 
40
        RW+     =   tester
 
41
';
 
42
 
 
43
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
44
try "
 
45
        /Initialized empty Git repository in .*/r1a.git//
 
46
        /Initialized empty Git repository in .*/r1b.git//
 
47
";
 
48
 
 
49
# u1 push u1r pass
 
50
put   "conf/fragments/u1r.conf", '
 
51
    repo @u1r
 
52
        RW+     =   u5
 
53
';
 
54
try "SUBCONF_PUSH u1 u1; !/FATAL/" or die text();
 
55
 
 
56
# u2 main push fail
 
57
confadd '
 
58
    repo @u1r
 
59
        RW+     =   u6
 
60
';
 
61
try "SUBCONF_PUSH u2 u2; /FATAL/;
 
62
        /W VREF/NAME/conf/gitolite.conf gitolite-admin u2 DENIED by VREF/NAME//
 
63
";
 
64
 
 
65
try "git reset --hard origin/master; ok";
 
66
 
 
67
# u2 push u1r fail
 
68
put   "conf/fragments/u1r.conf", '
 
69
    repo @u1r
 
70
        RW+     =   u6
 
71
';
 
72
try "SUBCONF_PUSH u2 u2; /FATAL/
 
73
        /W VREF/NAME/conf/fragments/u1r.conf gitolite-admin u2 DENIED by VREF/NAME//
 
74
";
 
75
 
 
76
try "git reset --hard origin/master; ok";
 
77
 
 
78
# u3 set perms for r2a fail
 
79
put   "conf/fragments/u3r.conf", '
 
80
    repo r2a
 
81
        RW+     =   u6
 
82
';
 
83
try "SUBCONF_PUSH u3 u3;
 
84
        /WARNING: subconf 'u3r' attempting to set access for r2a/
 
85
";
 
86
 
 
87
try "git reset --hard origin/master; ok";
 
88
 
 
89
# u3 add r2b to u3r fail
 
90
 
 
91
put   "conf/fragments/u3r.conf", '
 
92
    @u3r    =   r2b
 
93
    repo @u3r
 
94
        RW+     =   u6
 
95
';
 
96
 
 
97
try "SUBCONF_PUSH u3 u3
 
98
        /WARNING: subconf 'u3r' attempting to set access for locally modified \@u3r/
 
99
";