summaryrefslogtreecommitdiffstats
path: root/t/hostname.t
blob: dfb8885d6d70b69aa456c5f2d563ddb40e07e8ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/perl
use strict;
use warnings;

# this is hardcoded; change it if needed
use lib "src/lib";
use Gitolite::Test;

# %HOSTNAME tests
# ----------------------------------------------------------------------

try "plan 60";

try "pwd";
my $od = text();
chomp($od);

# without setting HOSTNAME in rc
confreset;confadd '

    repo foo
        RW  dev/%HOSTNAME   =   u1
';

try "ADMIN_PUSH set1; /FATAL/";
try "/bad ref 'refs/heads/dev/%HOSTNAME'/";

# make a hostname entry
$ENV{G3T_RC} = "$ENV{HOME}/g3trc";
put "$ENV{G3T_RC}", "\$rc{HOSTNAME} = 'frodo';\n";

confreset;confadd '

    repo bar
        RW  %HOSTNAME_baz   =   u1
';

try "ADMIN_PUSH set1; /FATAL/";
try "/bad ref 'refs/heads/%HOSTNAME_baz'/";

confreset;confadd '

    repo bar
        RW  %HOSTNAME/      =   u1
        RW  %HOSTNAME-baz   =   u1
';

try "ADMIN_PUSH set1; !/FATAL/";
try "
    gitolite access bar u2 R any;                   /R any bar u2 DENIED by fallthru/
    gitolite access bar u2 W any;                   /W any bar u2 DENIED by fallthru/
    gitolite access bar u1 W any;                   !/DENIED/; /refs/heads/frodo/; !/baz/
    gitolite access bar u1 R any;                   !/DENIED/; /refs/heads/frodo/; !/baz/
    gitolite access bar u1 R refs/heads/frodo;      /R refs/heads/frodo bar u1 DENIED by fallthru/
    gitolite access bar u1 W refs/heads/frodo;      /W refs/heads/frodo bar u1 DENIED by fallthru/
    gitolite access bar u1 R refs/heads/frodo/1;    !/DENIED/; /refs/heads/frodo/; !/baz/
    gitolite access bar u1 W refs/heads/frodo/1;    !/DENIED/; /refs/heads/frodo/; !/baz/
    gitolite access bar u1 R refs/heads/sam;        /R refs/heads/sam bar u1 DENIED by fallthru/
    gitolite access bar u1 W refs/heads/sam;        /W refs/heads/sam bar u1 DENIED by fallthru/
    gitolite access bar u1 R refs/heads/master;     /R refs/heads/master bar u1 DENIED by fallthru/
    gitolite access bar u1 W refs/heads/master;     /W refs/heads/master bar u1 DENIED by fallthru/

    gitolite access bar u1 R refs/heads/frodo-baz;  !/DENIED/; /refs/heads/frodo-baz/
    gitolite access bar u1 W refs/heads/frodo-baz;  !/DENIED/; /refs/heads/frodo-baz/
";

confreset;confadd '

    repo foo-%HOSTNAME
        RW  =   u1
';

try "ADMIN_PUSH set1; !/FATAL/";
try "
    gitolite list-repos;            /foo-frodo/
    gitolite list-phy-repos;        /foo-frodo/
";