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

« back to all changes in this revision

Viewing changes to t/deleg-2.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 2
 
10
# ----------------------------------------------------------------------
 
11
 
 
12
try "plan 54";
 
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
    # group your projects/repos however you want
 
21
    @u1r    =   r1[ab]
 
22
    @u2r    =   r2[ab]
 
23
    @u3r    =   r3[ab]
 
24
 
 
25
    # the admin repo access was probably like this to start with:
 
26
    repo gitolite-admin
 
27
        RW                              = u1 u2 u3
 
28
        RW+ NAME/                       = admin
 
29
        RW  NAME/conf/fragments/u1r     = u1
 
30
        RW  NAME/conf/fragments/u2r     = u2
 
31
        RW  NAME/conf/fragments/u3r     = u3
 
32
        -   NAME/                       = @all
 
33
 
 
34
    subconf "fragments/*.conf"
 
35
';
 
36
 
 
37
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
38
 
 
39
try "mkdir -p conf/fragments; ok";
 
40
 
 
41
put "conf/fragments/u1r.conf", '
 
42
    repo r1a r1b
 
43
        C       =   @all
 
44
        RW+     =   CREATOR
 
45
    repo @u1r
 
46
        RW+     =   tester
 
47
';
 
48
 
 
49
put "conf/fragments/u2r.conf", '
 
50
    repo @u2r
 
51
        C       =   @all
 
52
        RW+     =   CREATOR
 
53
    repo @u2r
 
54
        RW+     =   tester
 
55
';
 
56
 
 
57
put "conf/fragments/u3r.conf", '
 
58
    repo @u3r
 
59
        C       =   @all
 
60
        RW+     =   CREATOR
 
61
    repo @u3r
 
62
        RW+     =   tester
 
63
';
 
64
 
 
65
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
66
try "
 
67
        /Initialized empty Git repository in .*/r1a.git//
 
68
        /Initialized empty Git repository in .*/r1b.git//
 
69
";
 
70
 
 
71
# u1 push u1r pass
 
72
put   "conf/fragments/u1r.conf", '
 
73
    repo @u1r
 
74
        RW+     =   u5
 
75
';
 
76
try "SUBCONF_PUSH u1 u1; !/FATAL/" or die text();
 
77
 
 
78
# u2 main push fail
 
79
confadd '
 
80
    repo @u1r
 
81
        RW+     =   u6
 
82
';
 
83
try "SUBCONF_PUSH u2 u2; /FATAL/;
 
84
        /W VREF/NAME/conf/gitolite.conf gitolite-admin u2 DENIED by VREF/NAME//
 
85
";
 
86
 
 
87
try "git reset --hard origin/master; ok";
 
88
 
 
89
# u2 push u1r fail
 
90
put   "conf/fragments/u1r.conf", '
 
91
    repo @u1r
 
92
        RW+     =   u6
 
93
';
 
94
try "SUBCONF_PUSH u2 u2; /FATAL/
 
95
        /W VREF/NAME/conf/fragments/u1r.conf gitolite-admin u2 DENIED by VREF/NAME//
 
96
";
 
97
 
 
98
try "git reset --hard origin/master; ok";
 
99
 
 
100
# u3 set perms for r2a fail
 
101
put   "conf/fragments/u3r.conf", '
 
102
    repo r2a
 
103
        RW+     =   u6
 
104
';
 
105
try "SUBCONF_PUSH u3 u3;
 
106
        /WARNING: subconf 'u3r' attempting to set access for r2a/
 
107
";
 
108
 
 
109
try "git reset --hard origin/master; ok";
 
110
 
 
111
# u3 add r2b to u3r fail
 
112
 
 
113
put   "conf/fragments/u3r.conf", '
 
114
    @u3r    =   r2b
 
115
    repo @u3r
 
116
        RW+     =   u6
 
117
';
 
118
 
 
119
try "SUBCONF_PUSH u3 u3
 
120
        /WARNING: subconf 'u3r' attempting to set access for locally modified \@u3r/
 
121
";