Index: /branches/eam_branches/ipp-20191011/Nebulous/t/56_client_find_instances.t
===================================================================
--- /branches/eam_branches/ipp-20191011/Nebulous/t/56_client_find_instances.t	(revision 40997)
+++ /branches/eam_branches/ipp-20191011/Nebulous/t/56_client_find_instances.t	(revision 40998)
@@ -10,5 +10,5 @@
 use Apache::Test qw( -withtestmore );
 
-plan tests => 29;
+plan tests => 35;
 
 use lib qw( ./t ./lib );
@@ -20,6 +20,80 @@
 my $hostport = Apache::Test->config->{ 'hostport' };
 
-Test::Nebulous->setup;
-
+### XXX EAM : this test suite finds real errors in the implementation.  
+
+## the API is now slightly different (what is the state of the API in the ipp ops code?)
+## find_instances ("key", "volume", find_invalid)
+
+## this returns a result even if we request a hard volume unless the hard volume is not valid
+
+Test::Nebulous->setup;
+Test::Nebulous->cleanup;
+
+### TEST BLOCK for find_invalid
+## Test::Nebulous->setup;
+## {
+##     # volume/key, volume override
+##     my $neb = Nebulous::Client->new(
+##         proxy => "http://$hostport/nebulous",
+##     );
+##     $neb->create( "foo", "~node02" );
+## #    $neb->replicate( "foo", "~node02" );
+## 
+##     Test::Nebulous->switch_node_state;
+##     my $tmphost;
+## 
+## #   my $locations = $neb->find_instances( "neb:///foo", "~node02", 1); # result : no instance
+## #   my $locations = $neb->find_instances( "neb:///foo", "~node02", 0); # result : no instance
+## #   my $locations = $neb->find_instances( "neb:///foo", "~node02"); # result : no instance
+## 
+## #   my $locations = $neb->find_instances( "neb:///foo", "node02", 1); # result : no instance
+## #   my $locations = $neb->find_instances( "neb:///foo", "node02", 0); # result : no instance
+## #   my $locations = $neb->find_instances( "neb:///foo", "node02"); # result : no instances
+## 
+## #   my $locations = $neb->find_instances( "neb:///foo", undef, 1);
+## #   my $locations = $neb->find_instances( "neb:///foo", undef, 0);
+## #   my $locations = $neb->find_instances( "neb:///foo", $tmphost, 0);
+## 
+## #   my $locations = $neb->find_instances( "neb:///foo", "bebaz", 1);
+## #   my $locations = $neb->find_instances( "neb:///foo", "bebaz", 0);
+## 
+## #   my $locations = $neb->find_instances( "neb:///foo");
+## #   my $locations = $neb->find_instances( "neb://bebaz/foo");
+## 
+## #   my $locations = $neb->find_instances( "neb:///foo");
+## #   my $locations = $neb->find_instances( "neb:///foo", undef, 0);
+## 
+##     foreach my $f (@$locations) {
+## 	print "location: $f\n";
+##     }
+## 
+##     is( scalar @$locations, 1, "found 1" );
+##     like( @$locations[0], qr/file:/, "URIs match" );
+##     ok( -e _get_file_path( @$locations[0] ), "URI matches file" );
+## }
+## die "quit";
+
+## Test::Nebulous->setup;
+## eval {
+##     # volume/key, volume override
+##     my $neb = Nebulous::Client->new(
+##         proxy => "http://$hostport/nebulous",
+##     );
+##     $neb->create( "foo", "~node01" );
+## 
+##     my $locations_1 = $neb->find_instances( "neb://~invalid/foo", "~invalid");
+##     is($locations_1, undef, "no instances in invalid node" );
+## 
+##     # EAM: we fail this test because the logic of find_instances has
+##     # changed: as long as there is an instance on a valid node, the
+##     # instance gets returned
+##     my $locations = $neb->find_instances( "neb://node01/foo", "~node02" );
+##     is($locations, undef, "no instances on specified volume" );
+## };
+##print "result: $@\n";
+##like( $@, qr/result message/, "my message" );
+
+# find a single instance by raw name (foo)
+Test::Nebulous->setup;
 {
     # key
@@ -36,6 +110,6 @@
 }
 
-Test::Nebulous->setup;
-
+# find a both instances of a duplicated object
+Test::Nebulous->setup;
 {
     # key
@@ -56,5 +130,4 @@
 
 Test::Nebulous->setup;
-
 {
     # key, volume
@@ -103,6 +176,7 @@
 }
 
-Test::Nebulous->setup;
-
+# find instance using hard_volume for wrong node
+# (should still return a valid instance)
+Test::Nebulous->setup;
 {
     # volume/key, volume override
@@ -114,5 +188,49 @@
     my $locations = $neb->find_instances( "neb://node01/foo", "~node02" );
 
-    is($locations, undef, "no instances on specified volume" );
+    is( scalar @$locations, 1, "found 1" );
+    like( @$locations[0], qr/file:/, "URIs match" );
+    ok( -e _get_file_path( @$locations[0] ), "URI matches file" );
+#   the API used to return undef if we used a hard_volume but it was not there
+#   is($locations, undef, "no instances on specified volume" );
+}
+
+# find instance using hard_volume for unknown node
+# (should fail)
+Test::Nebulous->setup;
+{
+    # volume/key, volume override
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->create( "foo", "~node01" );
+
+    my $locations = $neb->find_instances( "neb://node01/foo", "~nobody" );
+
+    is( scalar @$locations, 0, "found 0" );
+#    like( @$locations[0], qr/file:/, "URIs match" );
+#    ok( -e _get_file_path( @$locations[0] ), "URI matches file" );
+
+#   the API used to return undef if we used a hard_volume but it was not there
+#   is($locations, undef, "no instances on specified volume" );
+}
+
+# find instance using hard_volume for unavailable node
+# (should fail)
+Test::Nebulous->setup;
+{
+    # volume/key, volume override
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->create( "foo", "~node01" );
+
+    my $locations = $neb->find_instances( "neb://node01/foo", "~node04" );
+
+    is( scalar @$locations, 1, "found 1" );
+    like( @$locations[0], qr/file:/, "URIs match" );
+    ok( -e _get_file_path( @$locations[0] ), "URI matches file" );
+
+#   the API used to return undef if we used a hard_volume but it was not there
+#   is($locations, undef, "no instances on specified volume" );
 }
 
@@ -153,5 +271,4 @@
 
 Test::Nebulous->setup;
-
 {
     my $neb = Nebulous::Client->new(
@@ -171,5 +288,5 @@
     $neb->find_instances();
 };
-like( $@, qr/1 - 2 were expected/, "no params" );
+like( $@, qr/1 - 3 were expected/, "no params" );
 
 Test::Nebulous->setup;
@@ -180,7 +297,7 @@
     );
 
-    $neb->find_instances( "foo", 'read', 3 );
+    $neb->find_instances( "foo", 'read', 3, 5 );
 };
-like( $@, qr/1 - 2 were expected/, "too many params" );
+like( $@, qr/1 - 3 were expected/, "too many params" );
 
 Test::Nebulous->cleanup;
Index: /branches/eam_branches/ipp-20191011/Nebulous/t/59_client_delete.t
===================================================================
--- /branches/eam_branches/ipp-20191011/Nebulous/t/59_client_delete.t	(revision 40997)
+++ /branches/eam_branches/ipp-20191011/Nebulous/t/59_client_delete.t	(revision 40998)
@@ -10,5 +10,5 @@
 use Apache::Test qw( -withtestmore );
 
-plan tests => 13;
+plan tests => 18;
 
 use lib qw( ./t ./lib );
@@ -20,6 +20,22 @@
 my $hostport = Apache::Test->config->{ 'hostport' };
 
-Test::Nebulous->setup;
-
+# ensure fresh start:
+Test::Nebulous->setup;
+Test::Nebulous->cleanup;
+
+# test of the eval thing;
+## Test::Nebulous->setup;
+## eval {
+##     my $neb = Nebulous::Client->new(
+##         proxy => "http://$hostport/nebulous",
+##     );
+##     print "1\n";
+##     $neb->delete( "foo", 0, 1, 2 );
+##     print "2\n";
+## };
+## like( $@, qr/1 - 3 were expected/, "too many params" );
+## die "ex";
+
+Test::Nebulous->setup;
 {
     my $neb = Nebulous::Client->new(
@@ -78,7 +94,6 @@
 }
 
-# force flag
-Test::Nebulous->setup;
-
+# test passing in undefined force flag
+Test::Nebulous->setup;
 {
     my $neb = Nebulous::Client->new(
@@ -90,6 +105,6 @@
 }
 
-Test::Nebulous->setup;
-
+# test passing in force flag = 1
+Test::Nebulous->setup;
 {
     my $neb = Nebulous::Client->new(
@@ -101,4 +116,70 @@
 }
 
+# test passing in force flag = 0
+Test::Nebulous->setup;
+{
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->create( "foo" );
+
+    is( $neb->delete("foo", 0), 1, "force flag false" );
+}
+
+# test passing in force flag = 0 where disk file is removed
+Test::Nebulous->setup;
+eval {
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->create( "foo" );
+    my $locations = $neb->find_instances( "foo" );
+    my $diskfile = _get_file_path(@$locations[0]);
+    unlink $diskfile;
+    $neb->delete("foo", 0);
+};
+like( $@, qr/can't unlink file/, "no force flag, cannot delete inconsistent file" );
+
+# test passing in force flag = 1 where disk file is removed
+Test::Nebulous->setup;
+{
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->create( "foo" );
+    my $locations = $neb->find_instances( "foo" );
+    my $diskfile = _get_file_path(@$locations[0]);
+    unlink $diskfile;
+    is( $neb->delete("foo", 1), 1, "force flag true deletes file" );
+}
+
+# test passing in undef force flag where disk file is removed
+Test::Nebulous->setup;
+eval {
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->create( "foo" );
+    my $locations = $neb->find_instances( "foo" );
+    my $diskfile = _get_file_path(@$locations[0]);
+    unlink $diskfile;
+    $neb->delete("foo", undef);
+};
+like( $@, qr/can't unlink file/, "no force flag, cannot delete inconsistent file" );
+
+# test passing in undefined force flag where disk file is removed
+Test::Nebulous->setup;
+eval {
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->create( "foo" );
+    my $locations = $neb->find_instances( "foo" );
+    my $diskfile = _get_file_path(@$locations[0]);
+    unlink $diskfile;
+    $neb->delete("foo");
+};
+like( $@, qr/can't unlink file/, "no force flag, cannot delete inconsistent file" );
+
 Test::Nebulous->setup;
 
@@ -109,5 +190,5 @@
     $neb->delete();
 };
-like( $@, qr/1 - 2 were expected/, "no params" );
+like( $@, qr/1 - 3 were expected/, "no params" );
 
 Test::Nebulous->setup;
@@ -127,7 +208,7 @@
         proxy => "http://$hostport/nebulous",
     );
-    $neb->delete( "foo", 0, 2 );
-};
-like( $@, qr/1 - 2 were expected/, "too many params" );
+    $neb->delete( "foo", 0, 1, 2 );
+};
+like( $@, qr/1 - 3 were expected/, "too many params" );
 
 Test::Nebulous->cleanup;
Index: /branches/eam_branches/ipp-20191011/Nebulous/t/64_client_find_objects.t
===================================================================
--- /branches/eam_branches/ipp-20191011/Nebulous/t/64_client_find_objects.t	(revision 40997)
+++ /branches/eam_branches/ipp-20191011/Nebulous/t/64_client_find_objects.t	(revision 40998)
@@ -21,5 +21,4 @@
 
 Test::Nebulous->setup;
-
 {
     # key
Index: /branches/eam_branches/ipp-20191011/Nebulous/t/66_client_xattr.t
===================================================================
--- /branches/eam_branches/ipp-20191011/Nebulous/t/66_client_xattr.t	(revision 40997)
+++ /branches/eam_branches/ipp-20191011/Nebulous/t/66_client_xattr.t	(revision 40998)
@@ -21,8 +21,6 @@
 );
 
-# 1 key / xattr
-
-Test::Nebulous->setup;
-
+# setxattr
+Test::Nebulous->setup;
 {
     my $uri = $neb->create('foo');
@@ -46,7 +44,5 @@
 
 # multiple xattrs
-
-Test::Nebulous->setup;
-
+Test::Nebulous->setup;
 {
     my $uri = $neb->create('foo');
@@ -184,5 +180,5 @@
     $neb->getxattr('foo', 'user.bar');
 };
-like($@, qr|xattr neb:///foo:user.bar does not exist|,
+like($@, qr|xattr user.bar does not exist|,
     "get xattr from non-existant xattr key");
 
@@ -256,5 +252,5 @@
     $neb->removexattr('foo', 'user.bar');
 };
-like($@, qr|xattr neb:///foo:user.bar does not exist|,
+like($@, qr|xattr user.bar does not exist|,
     "remove xattr from non-existant xattr key");
 
Index: /branches/eam_branches/ipp-20191011/Nebulous/t/70_neb-ls.t
===================================================================
--- /branches/eam_branches/ipp-20191011/Nebulous/t/70_neb-ls.t	(revision 40997)
+++ /branches/eam_branches/ipp-20191011/Nebulous/t/70_neb-ls.t	(revision 40998)
@@ -23,4 +23,5 @@
 use Test::Cmd;
 use Nebulous::Client;
+use Nebulous::Util qw( :standard );
 use Test::Nebulous;
 
@@ -28,8 +29,7 @@
 my $neb_url  = "http://$hostport/nebulous";
 
-
 my $cmd = 'bin/neb-ls';
 
-# last ditch effort to make sure dsget is executable
+# last ditch effort to make sure neb-ls is executable
 chmod 0755, 'bin/neb-ls';
 
@@ -37,8 +37,7 @@
 isa_ok($test, 'Test::Cmd');
 
-# NEB_SERVER env var not set
+# test if NEB_SERVER env var not set
 undef $ENV{'NEB_SERVER'} if defined $ENV{'NEB_SERVER'};
 Test::Nebulous->setup;
-
 {
     $test->run(args => '');
@@ -46,7 +45,6 @@
 }
 
-# NEB_SERVER set
-Test::Nebulous->setup;
-
+# NEB_SERVER set (and used in the following tests)
+Test::Nebulous->setup;
 {
     $ENV{NEB_SERVER} = $neb_url;
@@ -57,13 +55,11 @@
 
 Test::Nebulous->setup;
-
-{
-    my $neb = Nebulous::Client->new(
-        proxy => $neb_url,
-    );
-    $neb->create('foo');
-
-    $test->run(args => '');
-
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('foo');
+
+    $test->run(args => '');
     is($? >> 8, 0, "exit code");
     like($test->stdout, qr/^foo$/,      "stdout");
@@ -72,5 +68,4 @@
 
 Test::Nebulous->setup;
-
 {
     my $neb = Nebulous::Client->new(
@@ -83,10 +78,27 @@
 
     is($? >> 8, 0, "exit code");
-    like($test->stdout, qr/^bar\nfoo$/,  "stdout");
+    like($test->stdout, qr/^bar\s+foo$/,  "stdout");
     like($test->stderr, qr/^$/,         "stderr");
 }
 
 Test::Nebulous->setup;
-
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('foo');
+
+    my $locations = $neb->find_instances( "foo" );
+    my $diskfile = _get_file_path( @$locations[0] );
+    my $filestats = `ls -l $diskfile`;
+
+    $test->run(args => '-l');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr/^$filestats$/,  "stdout");
+    like($test->stderr, qr/^$/,         "stderr");
+}
+
+Test::Nebulous->setup;
 {
     my $neb = Nebulous::Client->new(
@@ -96,5 +108,5 @@
     $neb->create('bar');
 
-    $test->run(args => '-l');
+    $test->run(args => '-c');
 
     is($? >> 8, 0, "exit code");
@@ -109,26 +121,10 @@
         proxy => $neb_url,
     );
-    $neb->create('foo');
-    $neb->create('bar');
-
-    $test->run(args => '-1');
-
-    is($? >> 8, 0, "exit code");
-    like($test->stdout, qr/^bar\nfoo\n$/,   "stdout");
-    like($test->stderr, qr/^$/,             "stderr");
-}
-
-Test::Nebulous->setup;
-
-{
-    my $neb = Nebulous::Client->new(
-        proxy => $neb_url,
-    );
-    $neb->create('a/foo');
-
-    $test->run(args => '');
-
-    is($? >> 8, 0, "exit code");
-    like($test->stdout, qr||,               "stdout");
+    $neb->create('a/foo');
+
+    $test->run(args => '');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr|^a/$|,           "stdout");
     like($test->stderr, qr/^$/,             "stderr");
 }
@@ -161,5 +157,5 @@
 
     is($? >> 8, 0, "exit code");
-    like($test->stdout, qr|^a/bar\na/foo$|,  "stdout");
+    like($test->stdout, qr|^a/bar\s+a/foo$|,  "stdout");
     like($test->stderr, qr/^$/,             "stderr");
 }
@@ -193,5 +189,5 @@
 
     is($? >> 8, 0, "exit code");
-    like($test->stdout, qr|^a/b/\na/foo$|,        "stdout");
+    like($test->stdout, qr|^a/b/\s+a/foo$|,        "stdout");
     like($test->stderr, qr/^$/,             "stderr");
 }
Index: /branches/eam_branches/ipp-20191011/Nebulous/t/71_client_there_can_be_only_one.t
===================================================================
--- /branches/eam_branches/ipp-20191011/Nebulous/t/71_client_there_can_be_only_one.t	(revision 40997)
+++ /branches/eam_branches/ipp-20191011/Nebulous/t/71_client_there_can_be_only_one.t	(revision 40998)
@@ -21,4 +21,7 @@
 
 Test::Nebulous->setup;
+Test::Nebulous->cleanup;
+
+Test::Nebulous->setup;
 
 {
@@ -38,6 +41,5 @@
 
 Test::Nebulous->setup;
-
-{
+eval {
     my $key = "foo";
     my $neb = Nebulous::Client->new(
@@ -45,6 +47,6 @@
     );
     $neb->create($key, "node01");
+
     my $uri = $neb->replicate($key, "node02");
-
     is($neb->there_can_be_only_one($key, "node02"), 1, "there can be only one!");
 
@@ -53,5 +55,6 @@
     is( scalar @$locations, 1, "found 1" );
     is($locations->[0], $uri, "instance on correct volume" );
-}
+};
+is($@, "", "there_can_be_only_one with supplied volume should succeed");
 
 Test::Nebulous->setup;
Index: /branches/eam_branches/ipp-20191011/Nebulous/t/72_neb-cull.t
===================================================================
--- /branches/eam_branches/ipp-20191011/Nebulous/t/72_neb-cull.t	(revision 40997)
+++ /branches/eam_branches/ipp-20191011/Nebulous/t/72_neb-cull.t	(revision 40998)
@@ -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,87 +105,110 @@
 
 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);
 
+    my $line = $test->stderr;
+
+    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");
+    like($test->stdout, qr/^$/, "stdout");
+    like($test->stderr, qr/^$/, "stderr");
+}
+
+## problem test
+Test::Nebulous->setup;
+
+{
+    my $key = 'foo';
+
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create($key);
+
+    $test->run(args => "--one_only " . $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, 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");
-    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);
+    like($test->stderr, qr/no instances/, "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key = 'foo';
+
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create($key);
+    $neb->replicate($key);
 
     $test->run(args => "--one_only " . $key);
 
     is($neb->stat($key)->[6], 1, "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);
+    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);
 
@@ -160,24 +231,4 @@
     $neb->create($key);
     $neb->replicate($key);
-    $neb->replicate($key);
-
-    $test->run(args => "--one_only " . $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);
 
     $test->run(args => "--min_copies 1 " . $key);
@@ -198,8 +249,14 @@
     );
     $neb->create($key);
+    my $statval1 = $neb->stat($key);
+    print "statval: @$statval1[6]\n";
 
     $test->run(args => "--min_copies 1 " . $key);
 
-    is($neb->stat($key)->[6], 1, "correct # of instances");
+    my $statval2 = $neb->stat($key);
+    print "statval: @$statval2[6]\n";
+
+    is($neb->stat($key)->[6], 1, "correct # of instances");
+
     is($? >> 8, 0, "exit code");
     like($test->stdout, qr/^$/, "stdout");
