test file_size with send to different shard
[cloudstore.git] / t / Gearman.t
index 6761056..6983d67 100755 (executable)
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 11;
+use Test::More tests => 19;
 use Data::Dump qw(dump);
 
 use lib 'lib';
@@ -16,7 +16,7 @@ my $user = $ARGV[0] || 2001;
 
 sub gearman {
        my ( $function, $args ) = @_;
-       ok my $o = CloudStore::Gearman->gearman_do( @_ ), $_[0];
+       ok my $o = CloudStore::Gearman->gearman_do( @_ ), join(' ',@_);
        diag dump $o;
        return $o;
 }
@@ -39,5 +39,18 @@ gearman send_file => '~u2001/foo.txt#~u2002/foo.txt';
 gearman rename_file => '~u2002/foo.txt#bar.txt';
 gearman rename_file => '~u2002/bar.txt#baz.txt';
 
+cmp_ok  
+gearman( file_size => '~u2001/foo.txt' ), '==',
+gearman( file_size => '~u2002/baz.txt' ), 'size_same';
+
+diag "test symlink to other shard";
+gearman send_file => '~u2001/foo.txt#~u2004/foo.txt';
+my $size_1 = gearman( file_size => '~u2001/foo.txt' );
+my $size_2 = gearman( file_size => '~u2004/foo.txt' );
+
+cmp_ok $size_1, '==', $size_2, 'symlink size same';
+
 gearman delete => '~u2002/baz.txt';
 
+ok ! CloudStore::Gearman->gearman_do( file_size => '~u2002/baz.txt' ), 'deleted file size';
+