IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 28, 2019, 4:26:42 PM (7 years ago)
Author:
eugene
Message:

find_instances has some inconsistencies : meaning of hard_volume, use of find_invalid

Location:
branches/eam_branches/ipp-20191011/Nebulous/t
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20191011/Nebulous/t/56_client_find_instances.t

    r19469 r40998  
    1010use Apache::Test qw( -withtestmore );
    1111
    12 plan tests => 29;
     12plan tests => 35;
    1313
    1414use lib qw( ./t ./lib );
     
    2020my $hostport = Apache::Test->config->{ 'hostport' };
    2121
    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
     29Test::Nebulous->setup;
     30Test::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)
     97Test::Nebulous->setup;
    2498{
    2599    # key
     
    36110}
    37111
    38 Test::Nebulous->setup;
    39 
     112# find a both instances of a duplicated object
     113Test::Nebulous->setup;
    40114{
    41115    # key
     
    56130
    57131Test::Nebulous->setup;
    58 
    59132{
    60133    # key, volume
     
    103176}
    104177
    105 Test::Nebulous->setup;
    106 
     178# find instance using hard_volume for wrong node
     179# (should still return a valid instance)
     180Test::Nebulous->setup;
    107181{
    108182    # volume/key, volume override
     
    114188    my $locations = $neb->find_instances( "neb://node01/foo", "~node02" );
    115189
    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)
     199Test::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)
     219Test::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" );
    117235}
    118236
     
    153271
    154272Test::Nebulous->setup;
    155 
    156273{
    157274    my $neb = Nebulous::Client->new(
     
    171288    $neb->find_instances();
    172289};
    173 like( $@, qr/1 - 2 were expected/, "no params" );
     290like( $@, qr/1 - 3 were expected/, "no params" );
    174291
    175292Test::Nebulous->setup;
     
    180297    );
    181298
    182     $neb->find_instances( "foo", 'read', 3 );
     299    $neb->find_instances( "foo", 'read', 3, 5 );
    183300};
    184 like( $@, qr/1 - 2 were expected/, "too many params" );
     301like( $@, qr/1 - 3 were expected/, "too many params" );
    185302
    186303Test::Nebulous->cleanup;
  • branches/eam_branches/ipp-20191011/Nebulous/t/59_client_delete.t

    r24440 r40998  
    1010use Apache::Test qw( -withtestmore );
    1111
    12 plan tests => 13;
     12plan tests => 18;
    1313
    1414use lib qw( ./t ./lib );
     
    2020my $hostport = Apache::Test->config->{ 'hostport' };
    2121
    22 Test::Nebulous->setup;
    23 
     22# ensure fresh start:
     23Test::Nebulous->setup;
     24Test::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
     39Test::Nebulous->setup;
    2440{
    2541    my $neb = Nebulous::Client->new(
     
    7894}
    7995
    80 # force flag
    81 Test::Nebulous->setup;
    82 
     96# test passing in undefined force flag
     97Test::Nebulous->setup;
    8398{
    8499    my $neb = Nebulous::Client->new(
     
    90105}
    91106
    92 Test::Nebulous->setup;
    93 
     107# test passing in force flag = 1
     108Test::Nebulous->setup;
    94109{
    95110    my $neb = Nebulous::Client->new(
     
    101116}
    102117
     118# test passing in force flag = 0
     119Test::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
     130Test::Nebulous->setup;
     131eval {
     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};
     141like( $@, 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
     144Test::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
     157Test::Nebulous->setup;
     158eval {
     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};
     168like( $@, 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
     171Test::Nebulous->setup;
     172eval {
     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};
     182like( $@, qr/can't unlink file/, "no force flag, cannot delete inconsistent file" );
     183
    103184Test::Nebulous->setup;
    104185
     
    109190    $neb->delete();
    110191};
    111 like( $@, qr/1 - 2 were expected/, "no params" );
     192like( $@, qr/1 - 3 were expected/, "no params" );
    112193
    113194Test::Nebulous->setup;
     
    127208        proxy => "http://$hostport/nebulous",
    128209    );
    129     $neb->delete( "foo", 0, 2 );
    130 };
    131 like( $@, qr/1 - 2 were expected/, "too many params" );
     210    $neb->delete( "foo", 0, 1, 2 );
     211};
     212like( $@, qr/1 - 3 were expected/, "too many params" );
    132213
    133214Test::Nebulous->cleanup;
  • branches/eam_branches/ipp-20191011/Nebulous/t/64_client_find_objects.t

    r17693 r40998  
    2121
    2222Test::Nebulous->setup;
    23 
    2423{
    2524    # key
  • branches/eam_branches/ipp-20191011/Nebulous/t/66_client_xattr.t

    r24301 r40998  
    2121);
    2222
    23 # 1 key / xattr
    24 
    25 Test::Nebulous->setup;
    26 
     23# setxattr
     24Test::Nebulous->setup;
    2725{
    2826    my $uri = $neb->create('foo');
     
    4644
    4745# multiple xattrs
    48 
    49 Test::Nebulous->setup;
    50 
     46Test::Nebulous->setup;
    5147{
    5248    my $uri = $neb->create('foo');
     
    184180    $neb->getxattr('foo', 'user.bar');
    185181};
    186 like($@, qr|xattr neb:///foo:user.bar does not exist|,
     182like($@, qr|xattr user.bar does not exist|,
    187183    "get xattr from non-existant xattr key");
    188184
     
    256252    $neb->removexattr('foo', 'user.bar');
    257253};
    258 like($@, qr|xattr neb:///foo:user.bar does not exist|,
     254like($@, qr|xattr user.bar does not exist|,
    259255    "remove xattr from non-existant xattr key");
    260256
  • branches/eam_branches/ipp-20191011/Nebulous/t/70_neb-ls.t

    r24560 r40998  
    2323use Test::Cmd;
    2424use Nebulous::Client;
     25use Nebulous::Util qw( :standard );
    2526use Test::Nebulous;
    2627
     
    2829my $neb_url  = "http://$hostport/nebulous";
    2930
    30 
    3131my $cmd = 'bin/neb-ls';
    3232
    33 # last ditch effort to make sure dsget is executable
     33# last ditch effort to make sure neb-ls is executable
    3434chmod 0755, 'bin/neb-ls';
    3535
     
    3737isa_ok($test, 'Test::Cmd');
    3838
    39 # NEB_SERVER env var not set
     39# test if NEB_SERVER env var not set
    4040undef $ENV{'NEB_SERVER'} if defined $ENV{'NEB_SERVER'};
    4141Test::Nebulous->setup;
    42 
    4342{
    4443    $test->run(args => '');
     
    4645}
    4746
    48 # NEB_SERVER set
    49 Test::Nebulous->setup;
    50 
     47# NEB_SERVER set (and used in the following tests)
     48Test::Nebulous->setup;
    5149{
    5250    $ENV{NEB_SERVER} = $neb_url;
     
    5755
    5856Test::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 => '');
    6864    is($? >> 8, 0, "exit code");
    6965    like($test->stdout, qr/^foo$/,      "stdout");
     
    7268
    7369Test::Nebulous->setup;
    74 
    7570{
    7671    my $neb = Nebulous::Client->new(
     
    8378
    8479    is($? >> 8, 0, "exit code");
    85     like($test->stdout, qr/^bar\nfoo$/,  "stdout");
     80    like($test->stdout, qr/^bar\s+foo$/,  "stdout");
    8681    like($test->stderr, qr/^$/,         "stderr");
    8782}
    8883
    8984Test::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
     102Test::Nebulous->setup;
    91103{
    92104    my $neb = Nebulous::Client->new(
     
    96108    $neb->create('bar');
    97109
    98     $test->run(args => '-l');
     110    $test->run(args => '-c');
    99111
    100112    is($? >> 8, 0, "exit code");
     
    109121        proxy => $neb_url,
    110122    );
    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");
    133129    like($test->stderr, qr/^$/,             "stderr");
    134130}
     
    161157
    162158    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");
    164160    like($test->stderr, qr/^$/,             "stderr");
    165161}
     
    193189
    194190    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");
    196192    like($test->stderr, qr/^$/,             "stderr");
    197193}
  • branches/eam_branches/ipp-20191011/Nebulous/t/71_client_there_can_be_only_one.t

    r24930 r40998  
    2121
    2222Test::Nebulous->setup;
     23Test::Nebulous->cleanup;
     24
     25Test::Nebulous->setup;
    2326
    2427{
     
    3841
    3942Test::Nebulous->setup;
    40 
    41 {
     43eval {
    4244    my $key = "foo";
    4345    my $neb = Nebulous::Client->new(
     
    4547    );
    4648    $neb->create($key, "node01");
     49
    4750    my $uri = $neb->replicate($key, "node02");
    48 
    4951    is($neb->there_can_be_only_one($key, "node02"), 1, "there can be only one!");
    5052
     
    5355    is( scalar @$locations, 1, "found 1" );
    5456    is($locations->[0], $uri, "instance on correct volume" );
    55 }
     57};
     58is($@, "", "there_can_be_only_one with supplied volume should succeed");
    5659
    5760Test::Nebulous->setup;
  • branches/eam_branches/ipp-20191011/Nebulous/t/72_neb-cull.t

    r25121 r40998  
    3939# NEB_SERVER env var not set
    4040undef $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
     91Test::Nebulous->setup;
    4392{
    4493    $test->run(args => '');
     
    4897# NEB_SERVER set
    4998Test::Nebulous->setup;
    50 
    5199{
    52100    $ENV{NEB_SERVER} = $neb_url;
     
    57105
    58106Test::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
     124Test::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);
    67134
    68135    $test->run(args => $key);
    69136
     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
     145Test::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
     166Test::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
    70178    is($neb->stat($key)->[6], 1, "correct # of instances");
    71179    is($? >> 8, 255, "exit code");
    72180    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
     184Test::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);
    124194
    125195    $test->run(args => "--one_only " . $key);
    126196
    127197    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
     203Test::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);
    142213    $neb->replicate($key);
    143214
     
    160231    $neb->create($key);
    161232    $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);
    182233
    183234    $test->run(args => "--min_copies 1 " . $key);
     
    198249    );
    199250    $neb->create($key);
     251    my $statval1 = $neb->stat($key);
     252    print "statval: @$statval1[6]\n";
    200253
    201254    $test->run(args => "--min_copies 1 " . $key);
    202255
    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
    204261    is($? >> 8, 0, "exit code");
    205262    like($test->stdout, qr/^$/, "stdout");
Note: See TracChangeset for help on using the changeset viewer.