- Timestamp:
- Oct 28, 2019, 4:26:42 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20191011/Nebulous/t/59_client_delete.t
r24440 r40998 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 1 3;12 plan tests => 18; 13 13 14 14 use lib qw( ./t ./lib ); … … 20 20 my $hostport = Apache::Test->config->{ 'hostport' }; 21 21 22 Test::Nebulous->setup; 23 22 # ensure fresh start: 23 Test::Nebulous->setup; 24 Test::Nebulous->cleanup; 25 26 # test of the eval thing; 27 ## Test::Nebulous->setup; 28 ## eval { 29 ## my $neb = Nebulous::Client->new( 30 ## proxy => "http://$hostport/nebulous", 31 ## ); 32 ## print "1\n"; 33 ## $neb->delete( "foo", 0, 1, 2 ); 34 ## print "2\n"; 35 ## }; 36 ## like( $@, qr/1 - 3 were expected/, "too many params" ); 37 ## die "ex"; 38 39 Test::Nebulous->setup; 24 40 { 25 41 my $neb = Nebulous::Client->new( … … 78 94 } 79 95 80 # force flag 81 Test::Nebulous->setup; 82 96 # test passing in undefined force flag 97 Test::Nebulous->setup; 83 98 { 84 99 my $neb = Nebulous::Client->new( … … 90 105 } 91 106 92 Test::Nebulous->setup; 93 107 # test passing in force flag = 1 108 Test::Nebulous->setup; 94 109 { 95 110 my $neb = Nebulous::Client->new( … … 101 116 } 102 117 118 # test passing in force flag = 0 119 Test::Nebulous->setup; 120 { 121 my $neb = Nebulous::Client->new( 122 proxy => "http://$hostport/nebulous", 123 ); 124 $neb->create( "foo" ); 125 126 is( $neb->delete("foo", 0), 1, "force flag false" ); 127 } 128 129 # test passing in force flag = 0 where disk file is removed 130 Test::Nebulous->setup; 131 eval { 132 my $neb = Nebulous::Client->new( 133 proxy => "http://$hostport/nebulous", 134 ); 135 $neb->create( "foo" ); 136 my $locations = $neb->find_instances( "foo" ); 137 my $diskfile = _get_file_path(@$locations[0]); 138 unlink $diskfile; 139 $neb->delete("foo", 0); 140 }; 141 like( $@, qr/can't unlink file/, "no force flag, cannot delete inconsistent file" ); 142 143 # test passing in force flag = 1 where disk file is removed 144 Test::Nebulous->setup; 145 { 146 my $neb = Nebulous::Client->new( 147 proxy => "http://$hostport/nebulous", 148 ); 149 $neb->create( "foo" ); 150 my $locations = $neb->find_instances( "foo" ); 151 my $diskfile = _get_file_path(@$locations[0]); 152 unlink $diskfile; 153 is( $neb->delete("foo", 1), 1, "force flag true deletes file" ); 154 } 155 156 # test passing in undef force flag where disk file is removed 157 Test::Nebulous->setup; 158 eval { 159 my $neb = Nebulous::Client->new( 160 proxy => "http://$hostport/nebulous", 161 ); 162 $neb->create( "foo" ); 163 my $locations = $neb->find_instances( "foo" ); 164 my $diskfile = _get_file_path(@$locations[0]); 165 unlink $diskfile; 166 $neb->delete("foo", undef); 167 }; 168 like( $@, qr/can't unlink file/, "no force flag, cannot delete inconsistent file" ); 169 170 # test passing in undefined force flag where disk file is removed 171 Test::Nebulous->setup; 172 eval { 173 my $neb = Nebulous::Client->new( 174 proxy => "http://$hostport/nebulous", 175 ); 176 $neb->create( "foo" ); 177 my $locations = $neb->find_instances( "foo" ); 178 my $diskfile = _get_file_path(@$locations[0]); 179 unlink $diskfile; 180 $neb->delete("foo"); 181 }; 182 like( $@, qr/can't unlink file/, "no force flag, cannot delete inconsistent file" ); 183 103 184 Test::Nebulous->setup; 104 185 … … 109 190 $neb->delete(); 110 191 }; 111 like( $@, qr/1 - 2were expected/, "no params" );192 like( $@, qr/1 - 3 were expected/, "no params" ); 112 193 113 194 Test::Nebulous->setup; … … 127 208 proxy => "http://$hostport/nebulous", 128 209 ); 129 $neb->delete( "foo", 0, 2 );130 }; 131 like( $@, qr/1 - 2were expected/, "too many params" );210 $neb->delete( "foo", 0, 1, 2 ); 211 }; 212 like( $@, qr/1 - 3 were expected/, "too many params" ); 132 213 133 214 Test::Nebulous->cleanup;
Note:
See TracChangeset
for help on using the changeset viewer.
