IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 18, 2009, 5:02:45 PM (17 years ago)
Author:
jhoblitt
Message:

start neb-cull --min_copies

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/t/72_neb-cull.t

    r24996 r25121  
    1717
    1818use Apache::Test qw( -withtestmore );
    19 plan tests => 29;
     19plan tests => 41;
    2020
    2121use lib qw( ./lib ./t );
     
    7171    is($? >> 8, 255, "exit code");
    7272    like($test->stdout, qr/^$/, "stdout");
     73    like($test->stderr, qr/failed to cull Nebulous key/, "stderr");
     74}
     75
     76Test::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
     95Test::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
     115Test::Nebulous->setup;
     116
     117{
     118    my $key = 'foo';
     119
     120    my $neb = Nebulous::Client->new(
     121        proxy => $neb_url,
     122    );
     123    $neb->create($key);
     124
     125    $test->run(args => "--one_only " . $key);
     126
     127    is($neb->stat($key)->[6], 1, "correct # of instances");
     128    is($? >> 8, 255, "exit code");
     129    like($test->stdout, qr/^$/, "stdout");
    73130    like($test->stderr, qr/not enough instances/, "stderr");
    74131}
     
    85142    $neb->replicate($key);
    86143
    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);
    124 
    125144    $test->run(args => "--one_only " . $key);
    126145
    127146    is($neb->stat($key)->[6], 1, "correct # of instances");
    128     is($? >> 8, 255, "exit code");
     147    is($? >> 8, 0, "exit code");
     148    like($test->stdout, qr/^$/, "stdout");
     149    like($test->stderr, qr/^$/, "stderr");
     150}
     151
     152Test::Nebulous->setup;
     153
     154{
     155    my $key = 'foo';
     156
     157    my $neb = Nebulous::Client->new(
     158        proxy => $neb_url,
     159    );
     160    $neb->create($key);
     161    $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
     172Test::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
     183    $test->run(args => "--min_copies 1 " . $key);
     184
     185    is($neb->stat($key)->[6], 1, "correct # of instances");
     186    is($? >> 8, 0, "exit code");
     187    like($test->stdout, qr/^$/, "stdout");
     188    like($test->stderr, qr/^$/, "stderr");
     189}
     190
     191Test::Nebulous->setup;
     192
     193{
     194    my $key = 'foo';
     195
     196    my $neb = Nebulous::Client->new(
     197        proxy => $neb_url,
     198    );
     199    $neb->create($key);
     200
     201    $test->run(args => "--min_copies 1 " . $key);
     202
     203    is($neb->stat($key)->[6], 1, "correct # of instances");
     204    is($? >> 8, 0, "exit code");
    129205    like($test->stdout, qr/^$/, "stdout");
    130206    like($test->stderr, qr/not enough instances/, "stderr");
     
    141217    $neb->create($key);
    142218    $neb->replicate($key);
    143 
    144     $test->run(args => "--one_only " . $key);
    145 
    146     is($neb->stat($key)->[6], 1, "correct # of instances");
    147     is($? >> 8, 0, "exit code");
    148     like($test->stdout, qr/^$/, "stdout");
    149     like($test->stderr, qr/^$/, "stderr");
    150 }
    151 
    152 Test::Nebulous->setup;
    153 
    154 {
    155     my $key = 'foo';
    156 
    157     my $neb = Nebulous::Client->new(
    158         proxy => $neb_url,
    159     );
    160     $neb->create($key);
    161     $neb->replicate($key);
    162     $neb->replicate($key);
    163 
    164     $test->run(args => "--one_only " . $key);
     219    $neb->replicate($key);
     220
     221    $test->run(args => "--min_copies 2 " . $key);
    165222
    166223    is($neb->stat($key)->[6], 1, "correct # of instances");
Note: See TracChangeset for help on using the changeset viewer.