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

« back to all changes in this revision

Viewing changes to t/hostname.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
# %HOSTNAME tests
 
10
# ----------------------------------------------------------------------
 
11
 
 
12
try "plan 60";
 
13
 
 
14
try "pwd";
 
15
my $od = text();
 
16
chomp($od);
 
17
 
 
18
# without setting HOSTNAME in rc
 
19
confreset;confadd '
 
20
 
 
21
    repo foo
 
22
        RW  dev/%HOSTNAME   =   u1
 
23
';
 
24
 
 
25
try "ADMIN_PUSH set1; /FATAL/";
 
26
try "/bad ref 'refs/heads/dev/%HOSTNAME'/";
 
27
 
 
28
# make a hostname entry
 
29
$ENV{G3T_RC} = "$ENV{HOME}/g3trc";
 
30
put "$ENV{G3T_RC}", "\$rc{HOSTNAME} = 'frodo';\n";
 
31
 
 
32
confreset;confadd '
 
33
 
 
34
    repo bar
 
35
        RW  %HOSTNAME_baz   =   u1
 
36
';
 
37
 
 
38
try "ADMIN_PUSH set1; /FATAL/";
 
39
try "/bad ref 'refs/heads/%HOSTNAME_baz'/";
 
40
 
 
41
confreset;confadd '
 
42
 
 
43
    repo bar
 
44
        RW  %HOSTNAME/      =   u1
 
45
        RW  %HOSTNAME-baz   =   u1
 
46
';
 
47
 
 
48
try "ADMIN_PUSH set1; !/FATAL/";
 
49
try "
 
50
    gitolite access bar u2 R any;                   /R any bar u2 DENIED by fallthru/
 
51
    gitolite access bar u2 W any;                   /W any bar u2 DENIED by fallthru/
 
52
    gitolite access bar u1 W any;                   !/DENIED/; /refs/heads/frodo/; !/baz/
 
53
    gitolite access bar u1 R any;                   !/DENIED/; /refs/heads/frodo/; !/baz/
 
54
    gitolite access bar u1 R refs/heads/frodo;      /R refs/heads/frodo bar u1 DENIED by fallthru/
 
55
    gitolite access bar u1 W refs/heads/frodo;      /W refs/heads/frodo bar u1 DENIED by fallthru/
 
56
    gitolite access bar u1 R refs/heads/frodo/1;    !/DENIED/; /refs/heads/frodo/; !/baz/
 
57
    gitolite access bar u1 W refs/heads/frodo/1;    !/DENIED/; /refs/heads/frodo/; !/baz/
 
58
    gitolite access bar u1 R refs/heads/sam;        /R refs/heads/sam bar u1 DENIED by fallthru/
 
59
    gitolite access bar u1 W refs/heads/sam;        /W refs/heads/sam bar u1 DENIED by fallthru/
 
60
    gitolite access bar u1 R refs/heads/master;     /R refs/heads/master bar u1 DENIED by fallthru/
 
61
    gitolite access bar u1 W refs/heads/master;     /W refs/heads/master bar u1 DENIED by fallthru/
 
62
 
 
63
    gitolite access bar u1 R refs/heads/frodo-baz;  !/DENIED/; /refs/heads/frodo-baz/
 
64
    gitolite access bar u1 W refs/heads/frodo-baz;  !/DENIED/; /refs/heads/frodo-baz/
 
65
";
 
66
 
 
67
confreset;confadd '
 
68
 
 
69
    repo foo-%HOSTNAME
 
70
        RW  =   u1
 
71
';
 
72
 
 
73
try "ADMIN_PUSH set1; !/FATAL/";
 
74
try "
 
75
    gitolite list-repos;            /foo-frodo/
 
76
    gitolite list-phy-repos;        /foo-frodo/
 
77
";