Changeset 40998 for branches/eam_branches/ipp-20191011
- Timestamp:
- Oct 28, 2019, 4:26:42 PM (7 years ago)
- Location:
- branches/eam_branches/ipp-20191011/Nebulous/t
- Files:
-
- 7 edited
-
56_client_find_instances.t (modified) (9 diffs)
-
59_client_delete.t (modified) (7 diffs)
-
64_client_find_objects.t (modified) (1 diff)
-
66_client_xattr.t (modified) (4 diffs)
-
70_neb-ls.t (modified) (11 diffs)
-
71_client_there_can_be_only_one.t (modified) (4 diffs)
-
72_neb-cull.t (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20191011/Nebulous/t/56_client_find_instances.t
r19469 r40998 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 29;12 plan tests => 35; 13 13 14 14 use lib qw( ./t ./lib ); … … 20 20 my $hostport = Apache::Test->config->{ 'hostport' }; 21 21 22 Test::Nebulous->setup; 23 22 ### XXX EAM : this test suite finds real errors in the implementation. 23 24 ## the API is now slightly different (what is the state of the API in the ipp ops code?) 25 ## find_instances ("key", "volume", find_invalid) 26 27 ## this returns a result even if we request a hard volume unless the hard volume is not valid 28 29 Test::Nebulous->setup; 30 Test::Nebulous->cleanup; 31 32 ### TEST BLOCK for find_invalid 33 ## Test::Nebulous->setup; 34 ## { 35 ## # volume/key, volume override 36 ## my $neb = Nebulous::Client->new( 37 ## proxy => "http://$hostport/nebulous", 38 ## ); 39 ## $neb->create( "foo", "~node02" ); 40 ## # $neb->replicate( "foo", "~node02" ); 41 ## 42 ## Test::Nebulous->switch_node_state; 43 ## my $tmphost; 44 ## 45 ## # my $locations = $neb->find_instances( "neb:///foo", "~node02", 1); # result : no instance 46 ## # my $locations = $neb->find_instances( "neb:///foo", "~node02", 0); # result : no instance 47 ## # my $locations = $neb->find_instances( "neb:///foo", "~node02"); # result : no instance 48 ## 49 ## # my $locations = $neb->find_instances( "neb:///foo", "node02", 1); # result : no instance 50 ## # my $locations = $neb->find_instances( "neb:///foo", "node02", 0); # result : no instance 51 ## # my $locations = $neb->find_instances( "neb:///foo", "node02"); # result : no instances 52 ## 53 ## # my $locations = $neb->find_instances( "neb:///foo", undef, 1); 54 ## # my $locations = $neb->find_instances( "neb:///foo", undef, 0); 55 ## # my $locations = $neb->find_instances( "neb:///foo", $tmphost, 0); 56 ## 57 ## # my $locations = $neb->find_instances( "neb:///foo", "bebaz", 1); 58 ## # my $locations = $neb->find_instances( "neb:///foo", "bebaz", 0); 59 ## 60 ## # my $locations = $neb->find_instances( "neb:///foo"); 61 ## # my $locations = $neb->find_instances( "neb://bebaz/foo"); 62 ## 63 ## # my $locations = $neb->find_instances( "neb:///foo"); 64 ## # my $locations = $neb->find_instances( "neb:///foo", undef, 0); 65 ## 66 ## foreach my $f (@$locations) { 67 ## print "location: $f\n"; 68 ## } 69 ## 70 ## is( scalar @$locations, 1, "found 1" ); 71 ## like( @$locations[0], qr/file:/, "URIs match" ); 72 ## ok( -e _get_file_path( @$locations[0] ), "URI matches file" ); 73 ## } 74 ## die "quit"; 75 76 ## Test::Nebulous->setup; 77 ## eval { 78 ## # volume/key, volume override 79 ## my $neb = Nebulous::Client->new( 80 ## proxy => "http://$hostport/nebulous", 81 ## ); 82 ## $neb->create( "foo", "~node01" ); 83 ## 84 ## my $locations_1 = $neb->find_instances( "neb://~invalid/foo", "~invalid"); 85 ## is($locations_1, undef, "no instances in invalid node" ); 86 ## 87 ## # EAM: we fail this test because the logic of find_instances has 88 ## # changed: as long as there is an instance on a valid node, the 89 ## # instance gets returned 90 ## my $locations = $neb->find_instances( "neb://node01/foo", "~node02" ); 91 ## is($locations, undef, "no instances on specified volume" ); 92 ## }; 93 ##print "result: $@\n"; 94 ##like( $@, qr/result message/, "my message" ); 95 96 # find a single instance by raw name (foo) 97 Test::Nebulous->setup; 24 98 { 25 99 # key … … 36 110 } 37 111 38 Test::Nebulous->setup; 39 112 # find a both instances of a duplicated object 113 Test::Nebulous->setup; 40 114 { 41 115 # key … … 56 130 57 131 Test::Nebulous->setup; 58 59 132 { 60 133 # key, volume … … 103 176 } 104 177 105 Test::Nebulous->setup; 106 178 # find instance using hard_volume for wrong node 179 # (should still return a valid instance) 180 Test::Nebulous->setup; 107 181 { 108 182 # volume/key, volume override … … 114 188 my $locations = $neb->find_instances( "neb://node01/foo", "~node02" ); 115 189 116 is($locations, undef, "no instances on specified volume" ); 190 is( scalar @$locations, 1, "found 1" ); 191 like( @$locations[0], qr/file:/, "URIs match" ); 192 ok( -e _get_file_path( @$locations[0] ), "URI matches file" ); 193 # the API used to return undef if we used a hard_volume but it was not there 194 # is($locations, undef, "no instances on specified volume" ); 195 } 196 197 # find instance using hard_volume for unknown node 198 # (should fail) 199 Test::Nebulous->setup; 200 { 201 # volume/key, volume override 202 my $neb = Nebulous::Client->new( 203 proxy => "http://$hostport/nebulous", 204 ); 205 $neb->create( "foo", "~node01" ); 206 207 my $locations = $neb->find_instances( "neb://node01/foo", "~nobody" ); 208 209 is( scalar @$locations, 0, "found 0" ); 210 # like( @$locations[0], qr/file:/, "URIs match" ); 211 # ok( -e _get_file_path( @$locations[0] ), "URI matches file" ); 212 213 # the API used to return undef if we used a hard_volume but it was not there 214 # is($locations, undef, "no instances on specified volume" ); 215 } 216 217 # find instance using hard_volume for unavailable node 218 # (should fail) 219 Test::Nebulous->setup; 220 { 221 # volume/key, volume override 222 my $neb = Nebulous::Client->new( 223 proxy => "http://$hostport/nebulous", 224 ); 225 $neb->create( "foo", "~node01" ); 226 227 my $locations = $neb->find_instances( "neb://node01/foo", "~node04" ); 228 229 is( scalar @$locations, 1, "found 1" ); 230 like( @$locations[0], qr/file:/, "URIs match" ); 231 ok( -e _get_file_path( @$locations[0] ), "URI matches file" ); 232 233 # the API used to return undef if we used a hard_volume but it was not there 234 # is($locations, undef, "no instances on specified volume" ); 117 235 } 118 236 … … 153 271 154 272 Test::Nebulous->setup; 155 156 273 { 157 274 my $neb = Nebulous::Client->new( … … 171 288 $neb->find_instances(); 172 289 }; 173 like( $@, qr/1 - 2were expected/, "no params" );290 like( $@, qr/1 - 3 were expected/, "no params" ); 174 291 175 292 Test::Nebulous->setup; … … 180 297 ); 181 298 182 $neb->find_instances( "foo", 'read', 3 );299 $neb->find_instances( "foo", 'read', 3, 5 ); 183 300 }; 184 like( $@, qr/1 - 2were expected/, "too many params" );301 like( $@, qr/1 - 3 were expected/, "too many params" ); 185 302 186 303 Test::Nebulous->cleanup; -
branches/eam_branches/ipp-20191011/Nebulous/t/59_client_delete.t
r24440 r40998 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 1 3;12 plan tests => 18; 13 13 14 14 use lib qw( ./t ./lib ); … … 20 20 my $hostport = Apache::Test->config->{ 'hostport' }; 21 21 22 Test::Nebulous->setup; 23 22 # ensure fresh start: 23 Test::Nebulous->setup; 24 Test::Nebulous->cleanup; 25 26 # test of the eval thing; 27 ## Test::Nebulous->setup; 28 ## eval { 29 ## my $neb = Nebulous::Client->new( 30 ## proxy => "http://$hostport/nebulous", 31 ## ); 32 ## print "1\n"; 33 ## $neb->delete( "foo", 0, 1, 2 ); 34 ## print "2\n"; 35 ## }; 36 ## like( $@, qr/1 - 3 were expected/, "too many params" ); 37 ## die "ex"; 38 39 Test::Nebulous->setup; 24 40 { 25 41 my $neb = Nebulous::Client->new( … … 78 94 } 79 95 80 # force flag 81 Test::Nebulous->setup; 82 96 # test passing in undefined force flag 97 Test::Nebulous->setup; 83 98 { 84 99 my $neb = Nebulous::Client->new( … … 90 105 } 91 106 92 Test::Nebulous->setup; 93 107 # test passing in force flag = 1 108 Test::Nebulous->setup; 94 109 { 95 110 my $neb = Nebulous::Client->new( … … 101 116 } 102 117 118 # test passing in force flag = 0 119 Test::Nebulous->setup; 120 { 121 my $neb = Nebulous::Client->new( 122 proxy => "http://$hostport/nebulous", 123 ); 124 $neb->create( "foo" ); 125 126 is( $neb->delete("foo", 0), 1, "force flag false" ); 127 } 128 129 # test passing in force flag = 0 where disk file is removed 130 Test::Nebulous->setup; 131 eval { 132 my $neb = Nebulous::Client->new( 133 proxy => "http://$hostport/nebulous", 134 ); 135 $neb->create( "foo" ); 136 my $locations = $neb->find_instances( "foo" ); 137 my $diskfile = _get_file_path(@$locations[0]); 138 unlink $diskfile; 139 $neb->delete("foo", 0); 140 }; 141 like( $@, qr/can't unlink file/, "no force flag, cannot delete inconsistent file" ); 142 143 # test passing in force flag = 1 where disk file is removed 144 Test::Nebulous->setup; 145 { 146 my $neb = Nebulous::Client->new( 147 proxy => "http://$hostport/nebulous", 148 ); 149 $neb->create( "foo" ); 150 my $locations = $neb->find_instances( "foo" ); 151 my $diskfile = _get_file_path(@$locations[0]); 152 unlink $diskfile; 153 is( $neb->delete("foo", 1), 1, "force flag true deletes file" ); 154 } 155 156 # test passing in undef force flag where disk file is removed 157 Test::Nebulous->setup; 158 eval { 159 my $neb = Nebulous::Client->new( 160 proxy => "http://$hostport/nebulous", 161 ); 162 $neb->create( "foo" ); 163 my $locations = $neb->find_instances( "foo" ); 164 my $diskfile = _get_file_path(@$locations[0]); 165 unlink $diskfile; 166 $neb->delete("foo", undef); 167 }; 168 like( $@, qr/can't unlink file/, "no force flag, cannot delete inconsistent file" ); 169 170 # test passing in undefined force flag where disk file is removed 171 Test::Nebulous->setup; 172 eval { 173 my $neb = Nebulous::Client->new( 174 proxy => "http://$hostport/nebulous", 175 ); 176 $neb->create( "foo" ); 177 my $locations = $neb->find_instances( "foo" ); 178 my $diskfile = _get_file_path(@$locations[0]); 179 unlink $diskfile; 180 $neb->delete("foo"); 181 }; 182 like( $@, qr/can't unlink file/, "no force flag, cannot delete inconsistent file" ); 183 103 184 Test::Nebulous->setup; 104 185 … … 109 190 $neb->delete(); 110 191 }; 111 like( $@, qr/1 - 2were expected/, "no params" );192 like( $@, qr/1 - 3 were expected/, "no params" ); 112 193 113 194 Test::Nebulous->setup; … … 127 208 proxy => "http://$hostport/nebulous", 128 209 ); 129 $neb->delete( "foo", 0, 2 );130 }; 131 like( $@, qr/1 - 2were expected/, "too many params" );210 $neb->delete( "foo", 0, 1, 2 ); 211 }; 212 like( $@, qr/1 - 3 were expected/, "too many params" ); 132 213 133 214 Test::Nebulous->cleanup; -
branches/eam_branches/ipp-20191011/Nebulous/t/64_client_find_objects.t
r17693 r40998 21 21 22 22 Test::Nebulous->setup; 23 24 23 { 25 24 # key -
branches/eam_branches/ipp-20191011/Nebulous/t/66_client_xattr.t
r24301 r40998 21 21 ); 22 22 23 # 1 key / xattr 24 25 Test::Nebulous->setup; 26 23 # setxattr 24 Test::Nebulous->setup; 27 25 { 28 26 my $uri = $neb->create('foo'); … … 46 44 47 45 # multiple xattrs 48 49 Test::Nebulous->setup; 50 46 Test::Nebulous->setup; 51 47 { 52 48 my $uri = $neb->create('foo'); … … 184 180 $neb->getxattr('foo', 'user.bar'); 185 181 }; 186 like($@, qr|xattr neb:///foo:user.bar does not exist|,182 like($@, qr|xattr user.bar does not exist|, 187 183 "get xattr from non-existant xattr key"); 188 184 … … 256 252 $neb->removexattr('foo', 'user.bar'); 257 253 }; 258 like($@, qr|xattr neb:///foo:user.bar does not exist|,254 like($@, qr|xattr user.bar does not exist|, 259 255 "remove xattr from non-existant xattr key"); 260 256 -
branches/eam_branches/ipp-20191011/Nebulous/t/70_neb-ls.t
r24560 r40998 23 23 use Test::Cmd; 24 24 use Nebulous::Client; 25 use Nebulous::Util qw( :standard ); 25 26 use Test::Nebulous; 26 27 … … 28 29 my $neb_url = "http://$hostport/nebulous"; 29 30 30 31 31 my $cmd = 'bin/neb-ls'; 32 32 33 # last ditch effort to make sure dsgetis executable33 # last ditch effort to make sure neb-ls is executable 34 34 chmod 0755, 'bin/neb-ls'; 35 35 … … 37 37 isa_ok($test, 'Test::Cmd'); 38 38 39 # NEB_SERVER env var not set39 # test if NEB_SERVER env var not set 40 40 undef $ENV{'NEB_SERVER'} if defined $ENV{'NEB_SERVER'}; 41 41 Test::Nebulous->setup; 42 43 42 { 44 43 $test->run(args => ''); … … 46 45 } 47 46 48 # NEB_SERVER set 49 Test::Nebulous->setup; 50 47 # NEB_SERVER set (and used in the following tests) 48 Test::Nebulous->setup; 51 49 { 52 50 $ENV{NEB_SERVER} = $neb_url; … … 57 55 58 56 Test::Nebulous->setup; 59 60 { 61 my $neb = Nebulous::Client->new( 62 proxy => $neb_url, 63 ); 64 $neb->create('foo'); 65 66 $test->run(args => ''); 67 57 { 58 my $neb = Nebulous::Client->new( 59 proxy => $neb_url, 60 ); 61 $neb->create('foo'); 62 63 $test->run(args => ''); 68 64 is($? >> 8, 0, "exit code"); 69 65 like($test->stdout, qr/^foo$/, "stdout"); … … 72 68 73 69 Test::Nebulous->setup; 74 75 70 { 76 71 my $neb = Nebulous::Client->new( … … 83 78 84 79 is($? >> 8, 0, "exit code"); 85 like($test->stdout, qr/^bar\ nfoo$/, "stdout");80 like($test->stdout, qr/^bar\s+foo$/, "stdout"); 86 81 like($test->stderr, qr/^$/, "stderr"); 87 82 } 88 83 89 84 Test::Nebulous->setup; 90 85 { 86 my $neb = Nebulous::Client->new( 87 proxy => $neb_url, 88 ); 89 $neb->create('foo'); 90 91 my $locations = $neb->find_instances( "foo" ); 92 my $diskfile = _get_file_path( @$locations[0] ); 93 my $filestats = `ls -l $diskfile`; 94 95 $test->run(args => '-l'); 96 97 is($? >> 8, 0, "exit code"); 98 like($test->stdout, qr/^$filestats$/, "stdout"); 99 like($test->stderr, qr/^$/, "stderr"); 100 } 101 102 Test::Nebulous->setup; 91 103 { 92 104 my $neb = Nebulous::Client->new( … … 96 108 $neb->create('bar'); 97 109 98 $test->run(args => '- l');110 $test->run(args => '-c'); 99 111 100 112 is($? >> 8, 0, "exit code"); … … 109 121 proxy => $neb_url, 110 122 ); 111 $neb->create('foo'); 112 $neb->create('bar'); 113 114 $test->run(args => '-1'); 115 116 is($? >> 8, 0, "exit code"); 117 like($test->stdout, qr/^bar\nfoo\n$/, "stdout"); 118 like($test->stderr, qr/^$/, "stderr"); 119 } 120 121 Test::Nebulous->setup; 122 123 { 124 my $neb = Nebulous::Client->new( 125 proxy => $neb_url, 126 ); 127 $neb->create('a/foo'); 128 129 $test->run(args => ''); 130 131 is($? >> 8, 0, "exit code"); 132 like($test->stdout, qr||, "stdout"); 123 $neb->create('a/foo'); 124 125 $test->run(args => ''); 126 127 is($? >> 8, 0, "exit code"); 128 like($test->stdout, qr|^a/$|, "stdout"); 133 129 like($test->stderr, qr/^$/, "stderr"); 134 130 } … … 161 157 162 158 is($? >> 8, 0, "exit code"); 163 like($test->stdout, qr|^a/bar\ na/foo$|, "stdout");159 like($test->stdout, qr|^a/bar\s+a/foo$|, "stdout"); 164 160 like($test->stderr, qr/^$/, "stderr"); 165 161 } … … 193 189 194 190 is($? >> 8, 0, "exit code"); 195 like($test->stdout, qr|^a/b/\ na/foo$|, "stdout");191 like($test->stdout, qr|^a/b/\s+a/foo$|, "stdout"); 196 192 like($test->stderr, qr/^$/, "stderr"); 197 193 } -
branches/eam_branches/ipp-20191011/Nebulous/t/71_client_there_can_be_only_one.t
r24930 r40998 21 21 22 22 Test::Nebulous->setup; 23 Test::Nebulous->cleanup; 24 25 Test::Nebulous->setup; 23 26 24 27 { … … 38 41 39 42 Test::Nebulous->setup; 40 41 { 43 eval { 42 44 my $key = "foo"; 43 45 my $neb = Nebulous::Client->new( … … 45 47 ); 46 48 $neb->create($key, "node01"); 49 47 50 my $uri = $neb->replicate($key, "node02"); 48 49 51 is($neb->there_can_be_only_one($key, "node02"), 1, "there can be only one!"); 50 52 … … 53 55 is( scalar @$locations, 1, "found 1" ); 54 56 is($locations->[0], $uri, "instance on correct volume" ); 55 } 57 }; 58 is($@, "", "there_can_be_only_one with supplied volume should succeed"); 56 59 57 60 Test::Nebulous->setup; -
branches/eam_branches/ipp-20191011/Nebulous/t/72_neb-cull.t
r25121 r40998 39 39 # NEB_SERVER env var not set 40 40 undef $ENV{'NEB_SERVER'} if defined $ENV{'NEB_SERVER'}; 41 Test::Nebulous->setup; 42 41 42 ## problem test 43 ## Test::Nebulous->setup; 44 ## { 45 ## $ENV{NEB_SERVER} = $neb_url; 46 ## 47 ## my $key = 'foo'; 48 ## 49 ## my $neb = Nebulous::Client->new( 50 ## proxy => $neb_url, 51 ## ); 52 ## $neb->create($key); 53 ## 54 ## $test->run(args => "--one_only " . $key); 55 ## 56 ## ## my $line1 = $test->stdout; 57 ## ## print "stdout: $line1\n"; 58 ## ## 59 ## ## my $line2 = $test->stderr; 60 ## ## print "stderr: $line2\n"; 61 ## 62 ## is($neb->stat($key)->[6], 1, "correct # of instances"); 63 ## is($? >> 8, 255, "exit code"); 64 ## like($test->stdout, qr/^$/, "stdout"); 65 ## like($test->stderr, qr/no instances/, "stderr"); 66 ## } 67 ## die "stop"; 68 69 ## Test::Nebulous->setup; 70 ## { 71 ## my $key = 'foo'; 72 ## 73 ## my $neb = Nebulous::Client->new( 74 ## proxy => $neb_url, 75 ## ); 76 ## $neb->create($key); 77 ## $neb->replicate($key); 78 ## 79 ## $test->run(args => "--server $neb_url $key"); 80 ## 81 ## my $line = $test->stderr; 82 ## print "stderr: $line\n"; 83 ## 84 ## is($neb->stat($key)->[6], 1, "correct # of instances"); 85 ## is($? >> 8, 0, "exit code"); 86 ## like($test->stdout, qr/^$/, "stdout"); 87 ## like($test->stderr, qr/^$/, "stderr"); 88 ## } 89 ## die "TEST"; 90 91 Test::Nebulous->setup; 43 92 { 44 93 $test->run(args => ''); … … 48 97 # NEB_SERVER set 49 98 Test::Nebulous->setup; 50 51 99 { 52 100 $ENV{NEB_SERVER} = $neb_url; … … 57 105 58 106 Test::Nebulous->setup; 59 60 { 61 my $key = 'foo'; 62 63 my $neb = Nebulous::Client->new( 64 proxy => $neb_url, 65 ); 66 $neb->create($key); 107 { 108 my $key = 'foo'; 109 110 my $neb = Nebulous::Client->new( 111 proxy => $neb_url, 112 ); 113 $neb->create($key); 114 115 $test->run(args => "--server $neb_url $key"); 116 # $test->run(args => $key); 117 118 is($neb->stat($key)->[6], 1, "correct # of instances"); 119 is($? >> 8, 255, "exit code"); 120 like($test->stdout, qr/^$/, "stdout"); 121 like($test->stderr, qr/failed to cull Nebulous key/, "stderr"); 122 } 123 124 Test::Nebulous->setup; 125 126 { 127 my $key = 'foo'; 128 129 my $neb = Nebulous::Client->new( 130 proxy => $neb_url, 131 ); 132 $neb->create($key); 133 $neb->replicate($key); 67 134 68 135 $test->run(args => $key); 69 136 137 my $line = $test->stderr; 138 139 is($neb->stat($key)->[6], 1, "correct # of instances"); 140 is($? >> 8, 0, "exit code"); 141 like($test->stdout, qr/^$/, "stdout"); 142 like($test->stderr, qr/^$/, "stderr"); 143 } 144 145 Test::Nebulous->setup; 146 147 { 148 my $key = 'foo'; 149 150 my $neb = Nebulous::Client->new( 151 proxy => $neb_url, 152 ); 153 $neb->create($key); 154 $neb->replicate($key); 155 $neb->replicate($key); 156 157 $test->run(args => $key); 158 159 is($neb->stat($key)->[6], 2, "correct # of instances"); 160 is($? >> 8, 0, "exit code"); 161 like($test->stdout, qr/^$/, "stdout"); 162 like($test->stderr, qr/^$/, "stderr"); 163 } 164 165 ## problem test 166 Test::Nebulous->setup; 167 168 { 169 my $key = 'foo'; 170 171 my $neb = Nebulous::Client->new( 172 proxy => $neb_url, 173 ); 174 $neb->create($key); 175 176 $test->run(args => "--one_only " . $key); 177 70 178 is($neb->stat($key)->[6], 1, "correct # of instances"); 71 179 is($? >> 8, 255, "exit code"); 72 180 like($test->stdout, qr/^$/, "stdout"); 73 like($test->stderr, qr/failed to cull Nebulous key/, "stderr"); 74 } 75 76 Test::Nebulous->setup; 77 78 { 79 my $key = 'foo'; 80 81 my $neb = Nebulous::Client->new( 82 proxy => $neb_url, 83 ); 84 $neb->create($key); 85 $neb->replicate($key); 86 87 $test->run(args => $key); 88 89 is($neb->stat($key)->[6], 1, "correct # of instances"); 90 is($? >> 8, 0, "exit code"); 91 like($test->stdout, qr/^$/, "stdout"); 92 like($test->stderr, qr/^$/, "stderr"); 93 } 94 95 Test::Nebulous->setup; 96 97 { 98 my $key = 'foo'; 99 100 my $neb = Nebulous::Client->new( 101 proxy => $neb_url, 102 ); 103 $neb->create($key); 104 $neb->replicate($key); 105 $neb->replicate($key); 106 107 $test->run(args => $key); 108 109 is($neb->stat($key)->[6], 2, "correct # of instances"); 110 is($? >> 8, 0, "exit code"); 111 like($test->stdout, qr/^$/, "stdout"); 112 like($test->stderr, qr/^$/, "stderr"); 113 } 114 115 Test::Nebulous->setup; 116 117 { 118 my $key = 'foo'; 119 120 my $neb = Nebulous::Client->new( 121 proxy => $neb_url, 122 ); 123 $neb->create($key); 181 like($test->stderr, qr/no instances/, "stderr"); 182 } 183 184 Test::Nebulous->setup; 185 186 { 187 my $key = 'foo'; 188 189 my $neb = Nebulous::Client->new( 190 proxy => $neb_url, 191 ); 192 $neb->create($key); 193 $neb->replicate($key); 124 194 125 195 $test->run(args => "--one_only " . $key); 126 196 127 197 is($neb->stat($key)->[6], 1, "correct # of instances"); 128 is($? >> 8, 255, "exit code"); 129 like($test->stdout, qr/^$/, "stdout"); 130 like($test->stderr, qr/not enough instances/, "stderr"); 131 } 132 133 Test::Nebulous->setup; 134 135 { 136 my $key = 'foo'; 137 138 my $neb = Nebulous::Client->new( 139 proxy => $neb_url, 140 ); 141 $neb->create($key); 198 is($? >> 8, 0, "exit code"); 199 like($test->stdout, qr/^$/, "stdout"); 200 like($test->stderr, qr/^$/, "stderr"); 201 } 202 203 Test::Nebulous->setup; 204 205 { 206 my $key = 'foo'; 207 208 my $neb = Nebulous::Client->new( 209 proxy => $neb_url, 210 ); 211 $neb->create($key); 212 $neb->replicate($key); 142 213 $neb->replicate($key); 143 214 … … 160 231 $neb->create($key); 161 232 $neb->replicate($key); 162 $neb->replicate($key);163 164 $test->run(args => "--one_only " . $key);165 166 is($neb->stat($key)->[6], 1, "correct # of instances");167 is($? >> 8, 0, "exit code");168 like($test->stdout, qr/^$/, "stdout");169 like($test->stderr, qr/^$/, "stderr");170 }171 172 Test::Nebulous->setup;173 174 {175 my $key = 'foo';176 177 my $neb = Nebulous::Client->new(178 proxy => $neb_url,179 );180 $neb->create($key);181 $neb->replicate($key);182 233 183 234 $test->run(args => "--min_copies 1 " . $key); … … 198 249 ); 199 250 $neb->create($key); 251 my $statval1 = $neb->stat($key); 252 print "statval: @$statval1[6]\n"; 200 253 201 254 $test->run(args => "--min_copies 1 " . $key); 202 255 203 is($neb->stat($key)->[6], 1, "correct # of instances"); 256 my $statval2 = $neb->stat($key); 257 print "statval: @$statval2[6]\n"; 258 259 is($neb->stat($key)->[6], 1, "correct # of instances"); 260 204 261 is($? >> 8, 0, "exit code"); 205 262 like($test->stdout, qr/^$/, "stdout");
Note:
See TracChangeset
for help on using the changeset viewer.
