Changeset 41013 for branches/eam_branches/ipp-20191011
- Timestamp:
- Oct 31, 2019, 10:35:20 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20191011/Nebulous/t/71_client_there_can_be_only_one.t
r40998 r41013 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 ); … … 23 23 Test::Nebulous->cleanup; 24 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 25 55 Test::Nebulous->setup; 26 27 56 { 28 57 my $key = "foo"; … … 40 69 } 41 70 71 ## volume is defined, only valid instances 42 72 Test::Nebulous->setup; 43 73 eval { … … 50 80 my $uri = $neb->replicate($key, "node02"); 51 81 is($neb->there_can_be_only_one($key, "node02"), 1, "there can be only one!"); 82 83 my $locations = $neb->find_instances( "foo" ); 84 85 is( scalar @$locations, 1, "found 1" ); 86 is($locations->[0], $uri, "instance on correct volume" ); 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!"); 52 106 53 107 my $locations = $neb->find_instances( "foo" );
Note:
See TracChangeset
for help on using the changeset viewer.
