eliminate race (loaded systems only?) that makes gl-conf look empty
[gitolite.git] / t / ssh-basic.t
blobebed2d22907c54f656d92d979777b6b87586b6b9
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 # this is hardcoded; change it if needed
6 use lib "src/lib";
7 use Gitolite::Common;
8 use Gitolite::Test;
10 # basic tests using ssh
11 # ----------------------------------------------------------------------
13 my $bd = `gitolite query-rc -n GL_BINDIR`;
14 my $h = $ENV{HOME};
15 my $ab = `gitolite query-rc -n GL_ADMIN_BASE`;
16 umask 0077;
18 try "
19 plan 26
21 # reset stuff
22 rm -f $h/.ssh/authorized_keys; ok or die 1
24 cp $bd/../t/keys/u[1-6]* $h/.ssh; ok or die 2
25 cp $bd/../t/keys/admin* $h/.ssh; ok or die 3
26 cp $bd/../t/keys/config $h/.ssh; ok or die 4
27 cat $h/.ssh/config
28 perl s/%USER/$ENV{USER}/
29 put $h/.ssh/config
31 mkdir $ab/keydir; ok or die 5
32 cp $bd/../t/keys/*.pub $ab/keydir; ok or die 6
35 system("gitolite ../triggers/post-compile/ssh-authkeys");
37 # basic tests
38 # ----------------------------------------------------------------------
40 confreset; confadd '
41 @g1 = u1
42 @g2 = u2
43 repo foo
44 RW = @g1 u3
45 R = @g2 u4
48 try "ADMIN_PUSH set3; !/FATAL/" or die text();
50 try "
51 ssh u1 info; ok; /R W\tfoo/
52 ssh u2 info; ok; /R \tfoo/
53 ssh u3 info; ok; /R W\tfoo/
54 ssh u4 info; ok; /R \tfoo/
55 ssh u5 info; ok; !/foo/
56 ssh u6 info; ok; !/foo/