Index: trunk/Nebulous/t/72_neb-cull.t
===================================================================
--- trunk/Nebulous/t/72_neb-cull.t	(revision 25121)
+++ trunk/Nebulous/t/72_neb-cull.t	(revision 41172)
@@ -39,6 +39,55 @@
 # NEB_SERVER env var not set
 undef $ENV{'NEB_SERVER'} if defined $ENV{'NEB_SERVER'};
-Test::Nebulous->setup;
-
+
+## problem test
+## Test::Nebulous->setup;
+## {
+##     $ENV{NEB_SERVER} = $neb_url;
+## 
+##     my $key = 'foo';
+## 
+##     my $neb = Nebulous::Client->new(
+##         proxy => $neb_url,
+##     );
+##     $neb->create($key);
+## 
+##     $test->run(args => "--one_only " . $key);
+## 
+##     ## my $line1 = $test->stdout;
+##     ## print "stdout: $line1\n";
+##     ## 
+##     ## my $line2 = $test->stderr;
+##     ## print "stderr: $line2\n";
+## 
+##     is($neb->stat($key)->[6], 1, "correct # of instances");
+##     is($? >> 8, 255, "exit code");
+##     like($test->stdout, qr/^$/, "stdout");
+##     like($test->stderr, qr/no instances/, "stderr");
+## }
+## die "stop";
+
+## Test::Nebulous->setup;
+## {
+##     my $key = 'foo';
+## 
+##     my $neb = Nebulous::Client->new(
+##         proxy => $neb_url,
+##     );
+##     $neb->create($key);
+##     $neb->replicate($key);
+## 
+##     $test->run(args => "--server $neb_url $key");
+## 
+##     my $line = $test->stderr;
+##     print "stderr: $line\n";
+## 
+##     is($neb->stat($key)->[6], 1, "correct # of instances");
+##     is($? >> 8, 0, "exit code");
+##     like($test->stdout, qr/^$/, "stdout");
+##     like($test->stderr, qr/^$/, "stderr");
+## }
+## die "TEST";
+
+Test::Nebulous->setup;
 {
     $test->run(args => '');
@@ -48,5 +97,4 @@
 # NEB_SERVER set
 Test::Nebulous->setup;
-
 {
     $ENV{NEB_SERVER} = $neb_url;
@@ -57,54 +105,57 @@
 
 Test::Nebulous->setup;
-
-{
-    my $key = 'foo';
-
-    my $neb = Nebulous::Client->new(
-        proxy => $neb_url,
-    );
-    $neb->create($key);
+{
+    my $key = 'foo';
+
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create($key);
+
+    $test->run(args => "--server $neb_url $key");
+#   $test->run(args => $key);
+
+    is($neb->stat($key)->[6], 1, "correct # of instances");
+    is($? >> 8, 255, "exit code");
+    like($test->stdout, qr/^$/, "stdout");
+    like($test->stderr, qr/failed to cull Nebulous key/, "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key = 'foo';
+
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create($key);
+    $neb->replicate($key);
 
     $test->run(args => $key);
 
-    is($neb->stat($key)->[6], 1, "correct # of instances");
-    is($? >> 8, 255, "exit code");
-    like($test->stdout, qr/^$/, "stdout");
-    like($test->stderr, qr/failed to cull Nebulous key/, "stderr");
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key = 'foo';
-
-    my $neb = Nebulous::Client->new(
-        proxy => $neb_url,
-    );
-    $neb->create($key);
+    my $line = $test->stderr;
+
+    # the default min_copies is 2:
+    is($neb->stat($key)->[6], 2, "correct # of instances");
+    is($? >> 8, 255, "exit code");
+    like($test->stdout, qr/^$/, "stdout");
+    like($test->stderr, qr/not enough instances/, "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key = 'foo';
+
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create($key);
+    $neb->replicate($key);
     $neb->replicate($key);
 
     $test->run(args => $key);
 
-    is($neb->stat($key)->[6], 1, "correct # of instances");
-    is($? >> 8, 0, "exit code");
-    like($test->stdout, qr/^$/, "stdout");
-    like($test->stderr, qr/^$/, "stderr");
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key = 'foo';
-
-    my $neb = Nebulous::Client->new(
-        proxy => $neb_url,
-    );
-    $neb->create($key);
-    $neb->replicate($key);
-    $neb->replicate($key);
-
-    $test->run(args => $key);
-
     is($neb->stat($key)->[6], 2, "correct # of instances");
     is($? >> 8, 0, "exit code");
@@ -113,4 +164,5 @@
 }
 
+## problem test
 Test::Nebulous->setup;
 
@@ -202,5 +254,6 @@
 
     is($neb->stat($key)->[6], 1, "correct # of instances");
-    is($? >> 8, 0, "exit code");
+
+    is($? >> 8, 255, "exit code");
     like($test->stdout, qr/^$/, "stdout");
     like($test->stderr, qr/not enough instances/, "stderr");
@@ -221,5 +274,5 @@
     $test->run(args => "--min_copies 2 " . $key);
 
-    is($neb->stat($key)->[6], 1, "correct # of instances");
+    is($neb->stat($key)->[6], 2, "correct # of instances");
     is($? >> 8, 0, "exit code");
     like($test->stdout, qr/^$/, "stdout");
