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 41012)
+++ /branches/eam_branches/ipp-20191011/Nebulous/t/71_client_there_can_be_only_one.t	(revision 41013)
@@ -10,5 +10,5 @@
 use Apache::Test qw( -withtestmore );
 
-plan tests => 8;
+plan tests => 13;
 
 use lib qw( ./t ./lib );
@@ -23,6 +23,35 @@
 Test::Nebulous->cleanup;
 
+## volume is defined, but it is not valid (should exit)
+## Test::Nebulous->setup;
+## {
+##     my $key = "foo";
+##     my $neb = Nebulous::Client->new(
+##         proxy => "http://$hostport/nebulous",
+##     );
+## 
+##     my $uri = $neb->create($key, "node01");
+## 
+##     $neb->replicate($key, "node02");
+## 
+##     ## set node02 to an invalid state:
+##     Test::Nebulous->switch_node_state;
+## 
+##     # if requested node is invalid, the other instance is kept and the invalid one removed
+##     # but since invalid instances are removed with a prune call, they are not counted
+##     # in the number of items removed (return by the function call)
+##     is($neb->there_can_be_only_one($key, "node02"), 0, "there can be only one!");
+##     my $locations = $neb->find_instances( "foo" );
+## 
+##     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");
+## die "asdf";
+
+#######
+
+## volume not defined
 Test::Nebulous->setup;
-
 {
     my $key = "foo";
@@ -40,4 +69,5 @@
 }
 
+## volume is defined, only valid instances
 Test::Nebulous->setup;
 eval {
@@ -50,4 +80,28 @@
     my $uri = $neb->replicate($key, "node02");
     is($neb->there_can_be_only_one($key, "node02"), 1, "there can be only one!");
+
+    my $locations = $neb->find_instances( "foo" );
+
+    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");
+
+## volume is defined, but it is not valid (should exit)
+Test::Nebulous->setup;
+eval {
+    my $key = "foo";
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    my $uri = $neb->create($key, "node01");
+
+    $neb->replicate($key, "node02");
+
+    ## set node02 to an invalid state:
+    Test::Nebulous->switch_node_state;
+
+    # if requested node is invalid, nothing is removed
+    is($neb->there_can_be_only_one($key, "node02"), 0, "there can be only one!");
 
     my $locations = $neb->find_instances( "foo" );
