Changeset 16221 for trunk/Nebulous/t/03_server_create_object.t
- Timestamp:
- Jan 24, 2008, 3:54:37 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous/t/03_server_create_object.t (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/t/03_server_create_object.t
r13302 r16221 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 03_server_create_object.t,v 1.2 0 2007-05-08 02:27:42jhoblitt Exp $5 # $Id: 03_server_create_object.t,v 1.21 2008-01-25 01:53:28 jhoblitt Exp $ 6 6 7 7 use strict; 8 8 use warnings FATAL => qw( all ); 9 9 10 use Test::More tests => 28;10 use Test::More tests => 64; 11 11 12 12 use lib qw( ./t ./lib ); … … 35 35 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 36 36 ok(-e $path, "file exists"); 37 ok($neb->find_instances("foo"), 'object key exists'); 38 uri_scheme_ok($uri, 'file'); 39 40 SKIP: { 41 skip "requires xattr support", 1 unless $test_xattr; 42 is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr'); 43 } 44 } 45 46 Test::Nebulous->setup; 47 48 { 49 # key 50 my $uri = $neb->create_object("neb:/foo"); 51 52 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 53 ok(-e $path, "file exists"); 54 ok($neb->find_instances("foo"), 'object key exists'); 55 uri_scheme_ok($uri, 'file'); 56 57 SKIP: { 58 skip "requires xattr support", 1 unless $test_xattr; 59 is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr'); 60 } 61 } 62 63 Test::Nebulous->setup; 64 65 { 66 # key 67 my $uri = $neb->create_object("neb://node01/foo"); 68 69 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 70 ok(-e $path, "file exists"); 71 ok($neb->find_instances("foo"), 'object key exists'); 72 uri_scheme_ok($uri, 'file'); 73 74 SKIP: { 75 skip "requires xattr support", 1 unless $test_xattr; 76 is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr'); 77 } 78 } 79 80 Test::Nebulous->setup; 81 82 { 83 # key 84 my $uri = $neb->create_object("neb://node02/foo"); 85 86 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 87 ok(-e $path, "file exists"); 88 ok($neb->find_instances("foo"), 'object key exists'); 37 89 uri_scheme_ok($uri, 'file'); 38 90 … … 51 103 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 52 104 ok(-e $path, "file exists"); 105 ok($neb->find_instances("foo"), 'object key exists'); 53 106 uri_scheme_ok($uri, 'file'); 54 107 … … 60 113 61 114 Test::Nebulous->setup; 115 { 116 # key 117 my $uri = $neb->create_object("neb:///foo"); 118 119 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 120 ok(-e $path, "file exists"); 121 ok($neb->find_instances("foo"), 'object key exists'); 122 uri_scheme_ok($uri, 'file'); 123 124 SKIP: { 125 skip "requires xattr support", 1 unless $test_xattr; 126 is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr'); 127 } 128 } 129 130 Test::Nebulous->setup; 62 131 63 132 { … … 67 136 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 68 137 ok(-e $path, "file exists"); 138 ok($neb->find_instances("foo"), 'object key exists'); 69 139 uri_scheme_ok($uri, 'file'); 70 140 … … 79 149 { 80 150 # key 151 my $uri = $neb->create_object("neb:/foo/"); 152 153 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 154 ok(-e $path, "file exists"); 155 ok($neb->find_instances("foo"), 'object key exists'); 156 uri_scheme_ok($uri, 'file'); 157 158 SKIP: { 159 skip "requires xattr support", 1 unless $test_xattr; 160 is(getfattr($path, 'user.nebulous_key'), '/foo/', 'user.nebulous_key xattr'); 161 } 162 } 163 164 Test::Nebulous->setup; 165 166 { 167 # key 81 168 my $uri = $neb->create_object("foo/"); 82 169 83 170 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 84 171 ok(-e $path, "file exists"); 172 ok($neb->find_instances("foo"), 'object key exists'); 85 173 uri_scheme_ok($uri, 'file'); 86 174 … … 99 187 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 100 188 ok(-e $path, "file exists"); 189 ok($neb->find_instances("foo/bar"), 'object key exists'); 101 190 uri_scheme_ok($uri, 'file'); 102 191 … … 115 204 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 116 205 ok(-e $path, "file exists"); 206 ok($neb->find_instances("foo/bar"), 'object key exists'); 117 207 uri_scheme_ok($uri, 'file'); 118 208 … … 131 221 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 132 222 ok(-e $path, "file exists"); 223 ok($neb->find_instances("foo"), 'object key exists'); 224 uri_scheme_ok($uri, 'file'); 225 } 226 227 Test::Nebulous->setup; 228 229 { 230 # volume name override 231 my $uri = $neb->create_object("neb://99/foo", "node01"); 232 233 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 234 ok(-e $path, "file exists"); 235 ok($neb->find_instances("foo"), 'object key exists'); 133 236 uri_scheme_ok($uri, 'file'); 134 237 } … … 145 248 146 249 eval { 250 $neb->create_object("neb:/foo"); 251 $neb->create_object("neb:/foo"); 252 }; 253 like($@, qr/Duplicate entry/, "object already exists"); 254 255 Test::Nebulous->setup; 256 257 eval { 147 258 $neb->create_object("foo", 'node03'); 148 259 }; … … 152 263 153 264 eval { 265 $neb->create_object("neb://node03/foo"); 266 }; 267 like($@, qr/node03 is not available/, "request volume this is full"); 268 269 Test::Nebulous->setup; 270 271 eval { 154 272 $neb->create_object("foo", 'node04'); 155 273 }; … … 159 277 160 278 eval { 279 $neb->create_object("neb://node04/foo"); 280 }; 281 like($@, qr/node04 is not available/, "request volume with allocate = FALSE, available = FALSE"); 282 283 Test::Nebulous->setup; 284 285 eval { 161 286 $neb->create_object("foo", 'node05'); 162 287 }; … … 166 291 167 292 eval { 293 $neb->create_object("neb://node05/foo"); 294 }; 295 like($@, qr/node05 is not available/, "request volume with allocate = FALSE , available = TRUE"); 296 297 Test::Nebulous->setup; 298 299 eval { 168 300 $neb->create_object("foo", 'node06'); 169 301 }; … … 173 305 174 306 eval { 307 $neb->create_object("neb://node06/foo"); 308 }; 309 like($@, qr/node06 is not available/, "request volume with allocate = TRUE, available = FALSE"); 310 311 Test::Nebulous->setup; 312 313 eval { 175 314 $neb->create_object("foo", 99); 176 315 }; … … 180 319 181 320 eval { 321 $neb->create_object("neb://99/foo"); 322 }; 323 like($@, qr/is not available/, "volume name doesn't exist"); 324 325 Test::Nebulous->setup; 326 327 eval { 182 328 $neb->create_object(); 183 329 };
Note:
See TracChangeset
for help on using the changeset viewer.
