Changeset 41172 for trunk/Nebulous/t/71_client_there_can_be_only_one.t
- Timestamp:
- Nov 27, 2019, 12:04:14 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/t/71_client_there_can_be_only_one.t
r24930 r41172 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 8;12 plan tests => 13; 13 13 14 14 use lib qw( ./t ./lib ); … … 21 21 22 22 Test::Nebulous->setup; 23 Test::Nebulous->cleanup; 23 24 25 ## volume is defined, but it is not valid (should exit) 26 ## Test::Nebulous->setup; 27 ## { 28 ## my $key = "foo"; 29 ## my $neb = Nebulous::Client->new( 30 ## proxy => "http://$hostport/nebulous", 31 ## ); 32 ## 33 ## my $uri = $neb->create($key, "node01"); 34 ## 35 ## $neb->replicate($key, "node02"); 36 ## 37 ## ## set node02 to an invalid state: 38 ## Test::Nebulous->switch_node_state; 39 ## 40 ## # if requested node is invalid, the other instance is kept and the invalid one removed 41 ## # but since invalid instances are removed with a prune call, they are not counted 42 ## # in the number of items removed (return by the function call) 43 ## is($neb->there_can_be_only_one($key, "node02"), 0, "there can be only one!"); 44 ## my $locations = $neb->find_instances( "foo" ); 45 ## 46 ## is( scalar @$locations, 1, "found 1" ); 47 ## is($locations->[0], $uri, "instance on correct volume" ); 48 ## }; 49 ## is($@, "", "there_can_be_only_one with supplied volume should succeed"); 50 ## die "asdf"; 51 52 ####### 53 54 ## volume not defined 55 Test::Nebulous->setup; 24 56 { 25 57 my $key = "foo"; … … 37 69 } 38 70 71 ## volume is defined, only valid instances 39 72 Test::Nebulous->setup; 40 41 { 73 eval { 42 74 my $key = "foo"; 43 75 my $neb = Nebulous::Client->new( … … 45 77 ); 46 78 $neb->create($key, "node01"); 79 47 80 my $uri = $neb->replicate($key, "node02"); 48 49 81 is($neb->there_can_be_only_one($key, "node02"), 1, "there can be only one!"); 50 82 … … 53 85 is( scalar @$locations, 1, "found 1" ); 54 86 is($locations->[0], $uri, "instance on correct volume" ); 55 } 87 }; 88 is($@, "", "there_can_be_only_one with supplied volume should succeed"); 89 90 ## volume is defined, but it is not valid (should exit) 91 Test::Nebulous->setup; 92 eval { 93 my $key = "foo"; 94 my $neb = Nebulous::Client->new( 95 proxy => "http://$hostport/nebulous", 96 ); 97 my $uri = $neb->create($key, "node01"); 98 99 $neb->replicate($key, "node02"); 100 101 ## set node02 to an invalid state: 102 Test::Nebulous->switch_node_state; 103 104 # if requested node is invalid, nothing is removed 105 is($neb->there_can_be_only_one($key, "node02"), 0, "there can be only one!"); 106 107 my $locations = $neb->find_instances( "foo" ); 108 109 is( scalar @$locations, 1, "found 1" ); 110 is($locations->[0], $uri, "instance on correct volume" ); 111 }; 112 is($@, "", "there_can_be_only_one with supplied volume should succeed"); 56 113 57 114 Test::Nebulous->setup;
Note:
See TracChangeset
for help on using the changeset viewer.
