IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 24, 2008, 3:54:37 PM (18 years ago)
Author:
jhoblitt
Message:

add Nebulous::Sever:: neb key/uri support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/t/03_server_create_object.t

    r13302 r16221  
    33# Copryight (C) 2004-2005  Joshua Hoblitt
    44#
    5 # $Id: 03_server_create_object.t,v 1.20 2007-05-08 02:27:42 jhoblitt Exp $
     5# $Id: 03_server_create_object.t,v 1.21 2008-01-25 01:53:28 jhoblitt Exp $
    66
    77use strict;
    88use warnings FATAL => qw( all );
    99
    10 use Test::More tests => 28;
     10use Test::More tests => 64;
    1111
    1212use lib qw( ./t ./lib );
     
    3535    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
    3636    ok(-e $path, "file exists");
     37    ok($neb->find_instances("foo"), 'object key exists');
     38    uri_scheme_ok($uri, 'file');
     39
     40SKIP: {
     41    skip "requires xattr support", 1 unless $test_xattr;
     42    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
     43}
     44}
     45
     46Test::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
     57SKIP: {
     58    skip "requires xattr support", 1 unless $test_xattr;
     59    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
     60}
     61}
     62
     63Test::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
     74SKIP: {
     75    skip "requires xattr support", 1 unless $test_xattr;
     76    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
     77}
     78}
     79
     80Test::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');
    3789    uri_scheme_ok($uri, 'file');
    3890
     
    51103    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
    52104    ok(-e $path, "file exists");
     105    ok($neb->find_instances("foo"), 'object key exists');
    53106    uri_scheme_ok($uri, 'file');
    54107
     
    60113
    61114Test::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
     124SKIP: {
     125    skip "requires xattr support", 1 unless $test_xattr;
     126    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
     127}
     128}
     129
     130Test::Nebulous->setup;
    62131
    63132{
     
    67136    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
    68137    ok(-e $path, "file exists");
     138    ok($neb->find_instances("foo"), 'object key exists');
    69139    uri_scheme_ok($uri, 'file');
    70140
     
    79149{
    80150    # 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
     158SKIP: {
     159    skip "requires xattr support", 1 unless $test_xattr;
     160    is(getfattr($path, 'user.nebulous_key'), '/foo/', 'user.nebulous_key xattr');
     161}
     162}
     163
     164Test::Nebulous->setup;
     165
     166{
     167    # key
    81168    my $uri = $neb->create_object("foo/");
    82169
    83170    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
    84171    ok(-e $path, "file exists");
     172    ok($neb->find_instances("foo"), 'object key exists');
    85173    uri_scheme_ok($uri, 'file');
    86174
     
    99187    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
    100188    ok(-e $path, "file exists");
     189    ok($neb->find_instances("foo/bar"), 'object key exists');
    101190    uri_scheme_ok($uri, 'file');
    102191
     
    115204    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
    116205    ok(-e $path, "file exists");
     206    ok($neb->find_instances("foo/bar"), 'object key exists');
    117207    uri_scheme_ok($uri, 'file');
    118208
     
    131221    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
    132222    ok(-e $path, "file exists");
     223    ok($neb->find_instances("foo"), 'object key exists');
     224    uri_scheme_ok($uri, 'file');
     225}
     226
     227Test::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');
    133236    uri_scheme_ok($uri, 'file');
    134237}
     
    145248
    146249eval {
     250    $neb->create_object("neb:/foo");
     251    $neb->create_object("neb:/foo");
     252};
     253like($@, qr/Duplicate entry/, "object already exists");
     254
     255Test::Nebulous->setup;
     256
     257eval {
    147258    $neb->create_object("foo", 'node03');
    148259};
     
    152263
    153264eval {
     265    $neb->create_object("neb://node03/foo");
     266};
     267like($@, qr/node03 is not available/, "request volume this is full");
     268
     269Test::Nebulous->setup;
     270
     271eval {
    154272    $neb->create_object("foo", 'node04');
    155273};
     
    159277
    160278eval {
     279    $neb->create_object("neb://node04/foo");
     280};
     281like($@, qr/node04 is not available/, "request volume with allocate = FALSE, available = FALSE");
     282
     283Test::Nebulous->setup;
     284
     285eval {
    161286    $neb->create_object("foo", 'node05');
    162287};
     
    166291
    167292eval {
     293    $neb->create_object("neb://node05/foo");
     294};
     295like($@, qr/node05 is not available/, "request volume with allocate = FALSE , available = TRUE");
     296
     297Test::Nebulous->setup;
     298
     299eval {
    168300    $neb->create_object("foo", 'node06');
    169301};
     
    173305
    174306eval {
     307    $neb->create_object("neb://node06/foo");
     308};
     309like($@, qr/node06 is not available/, "request volume with allocate = TRUE, available = FALSE");
     310
     311Test::Nebulous->setup;
     312
     313eval {
    175314    $neb->create_object("foo", 99);
    176315};
     
    180319
    181320eval {
     321    $neb->create_object("neb://99/foo");
     322};
     323like($@, qr/is not available/, "volume name doesn't exist");
     324
     325Test::Nebulous->setup;
     326
     327eval {
    182328    $neb->create_object();
    183329};
Note: See TracChangeset for help on using the changeset viewer.