switch to Gearman::XS
[cloudstore.git] / t / client.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4
5 use Test::More tests => 5;
6 use Data::Dump qw(dump);
7 use File::Slurp;
8
9 $ENV{RSYNC_PASSWORD} = 'password';
10
11 sub upload {
12         my $user = shift @_;
13         system('rsync', '-vv', @_, "rsync://$user\@127.0.0.1:6501/$user/" ), "rsync @_ $user";
14 }
15
16 mkdir('/tmp/client');
17
18 ok write_file('/tmp/client/one', "one" . time() );
19
20 diag "reload rsync config with invalid username";
21 upload('reload-config' => '/tmp/client/one');
22
23 ok upload('u2001' => '/tmp/client/one'), "upload";
24
25 ok upload('u2002' => '/tmp/client/one'), "upload shared";
26
27 ok write_file('/tmp/client/one', "modify");
28
29 ok upload('u2002' => '--inplace','/tmp/client/one'), "modify shared";