IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12643


Ignore:
Timestamp:
Mar 28, 2007, 11:48:24 AM (19 years ago)
Author:
jhoblitt
Message:

ws
check returned URI schemas

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/t/07_server_find_instances.t

    r10546 r12643  
    33# Copryight (C) 2004-2005  Joshua Hoblitt
    44#
    5 # $Id: 07_server_find_instances.t,v 1.6 2006-12-08 03:29:19 jhoblitt Exp $
     5# $Id: 07_server_find_instances.t,v 1.7 2007-03-28 21:48:24 jhoblitt Exp $
    66
    77use strict;
    88use warnings FATAL => qw( all );
    99
    10 use Test::More tests => 7;
     10use Test::More tests => 13;
    1111
    1212use lib qw( ./t ./lib );
     
    1414use Nebulous::Server;
    1515use Nebulous::Util qw( :standard );
     16use Test::URI;
    1617use Test::Nebulous;
    1718
     
    2627{
    2728    # key
    28     my $uri = $neb->create_object( "foo" );
     29    my $uri = $neb->create_object("foo");
    2930
    30     my $locations = $neb->find_instances( "foo" );
     31    my $locations = $neb->find_instances("foo");
    3132
    32     is( $uri, $locations->[0], "URIs match" );
     33    uri_scheme_ok($locations->[0], 'file');
     34    is($uri, $locations->[0], "URIs match");
    3335}
    3436
     
    3739{
    3840    # key
    39     my $uri1 = $neb->create_object( "foo" );
    40     my $uri2 = $neb->replicate_object( "foo" );
     41    my $uri1 = $neb->create_object("foo");
     42    my $uri2 = $neb->replicate_object("foo");
    4143
    42     my $locations = $neb->find_instances( "foo" );
     44    my $locations = $neb->find_instances("foo");
    4345
    44     ok( eq_set( [$uri1, $uri2], $locations ), "URIs match" );
     46    uri_scheme_ok($locations->[0], 'file');
     47    uri_scheme_ok($locations->[1], 'file');
     48    ok(eq_set([$uri1, $uri2], $locations), "URIs match");
    4549}
    4650
     
    4953{
    5054    # key, volume
    51     my $uri = $neb->create_object( "foo" );
     55    my $uri = $neb->create_object("foo");
    5256
    53     my $locations = $neb->find_instances( "foo", "node01" );
     57    my $locations = $neb->find_instances("foo", "node01");
    5458
    55     is( $uri, $locations->[0], "URIs match" );
     59    uri_scheme_ok($locations->[0], 'file');
     60    is($uri, $locations->[0], "URIs match");
    5661}
    5762
     
    6065{
    6166    # key
    62     my $uri1 = $neb->create_object( "foo" );
    63     my $uri2 = $neb->replicate_object( "foo" );
     67    my $uri1 = $neb->create_object("foo");
     68    my $uri2 = $neb->replicate_object("foo");
    6469
    65     my $locations = $neb->find_instances( "foo", "node01" );
     70    my $locations = $neb->find_instances("foo", "node01");
    6671
    67     ok( eq_set( [$uri1, $uri2], $locations ), "URIs match" );
     72    uri_scheme_ok($locations->[0], 'file');
     73    uri_scheme_ok($locations->[1], 'file');
     74    ok(eq_set([$uri1, $uri2], $locations), "URIs match");
    6875}
    6976
     
    7279
    7380eval {
    74     $neb->find_instances( "foo" );
     81    $neb->find_instances("foo");
    7582};
    76 like( $@, qr/no instances found/, "storage object does not exist" );
     83like($@, qr/no instances found/, "storage object does not exist");
    7784
    7885Test::Nebulous->setup;
     
    8188    $neb->find_instances();
    8289};
    83 like( $@, qr/1 - 2 were expected/, "no params" );
     90like($@, qr/1 - 2 were expected/, "no params");
    8491
    8592Test::Nebulous->setup;
    8693
    8794eval {
    88     $neb->find_instances( "foo", 'read', 3 );
     95    $neb->find_instances("foo", 'read', 3);
    8996};
    90 like( $@, qr/1 - 2 were expected/, "too many params" );
     97like($@, qr/1 - 2 were expected/, "too many params");
    9198
    9299Test::Nebulous->cleanup;
  • trunk/Nebulous/t/07_server_find_instances.t

    r10546 r12643  
    33# Copryight (C) 2004-2005  Joshua Hoblitt
    44#
    5 # $Id: 07_server_find_instances.t,v 1.6 2006-12-08 03:29:19 jhoblitt Exp $
     5# $Id: 07_server_find_instances.t,v 1.7 2007-03-28 21:48:24 jhoblitt Exp $
    66
    77use strict;
    88use warnings FATAL => qw( all );
    99
    10 use Test::More tests => 7;
     10use Test::More tests => 13;
    1111
    1212use lib qw( ./t ./lib );
     
    1414use Nebulous::Server;
    1515use Nebulous::Util qw( :standard );
     16use Test::URI;
    1617use Test::Nebulous;
    1718
     
    2627{
    2728    # key
    28     my $uri = $neb->create_object( "foo" );
     29    my $uri = $neb->create_object("foo");
    2930
    30     my $locations = $neb->find_instances( "foo" );
     31    my $locations = $neb->find_instances("foo");
    3132
    32     is( $uri, $locations->[0], "URIs match" );
     33    uri_scheme_ok($locations->[0], 'file');
     34    is($uri, $locations->[0], "URIs match");
    3335}
    3436
     
    3739{
    3840    # key
    39     my $uri1 = $neb->create_object( "foo" );
    40     my $uri2 = $neb->replicate_object( "foo" );
     41    my $uri1 = $neb->create_object("foo");
     42    my $uri2 = $neb->replicate_object("foo");
    4143
    42     my $locations = $neb->find_instances( "foo" );
     44    my $locations = $neb->find_instances("foo");
    4345
    44     ok( eq_set( [$uri1, $uri2], $locations ), "URIs match" );
     46    uri_scheme_ok($locations->[0], 'file');
     47    uri_scheme_ok($locations->[1], 'file');
     48    ok(eq_set([$uri1, $uri2], $locations), "URIs match");
    4549}
    4650
     
    4953{
    5054    # key, volume
    51     my $uri = $neb->create_object( "foo" );
     55    my $uri = $neb->create_object("foo");
    5256
    53     my $locations = $neb->find_instances( "foo", "node01" );
     57    my $locations = $neb->find_instances("foo", "node01");
    5458
    55     is( $uri, $locations->[0], "URIs match" );
     59    uri_scheme_ok($locations->[0], 'file');
     60    is($uri, $locations->[0], "URIs match");
    5661}
    5762
     
    6065{
    6166    # key
    62     my $uri1 = $neb->create_object( "foo" );
    63     my $uri2 = $neb->replicate_object( "foo" );
     67    my $uri1 = $neb->create_object("foo");
     68    my $uri2 = $neb->replicate_object("foo");
    6469
    65     my $locations = $neb->find_instances( "foo", "node01" );
     70    my $locations = $neb->find_instances("foo", "node01");
    6671
    67     ok( eq_set( [$uri1, $uri2], $locations ), "URIs match" );
     72    uri_scheme_ok($locations->[0], 'file');
     73    uri_scheme_ok($locations->[1], 'file');
     74    ok(eq_set([$uri1, $uri2], $locations), "URIs match");
    6875}
    6976
     
    7279
    7380eval {
    74     $neb->find_instances( "foo" );
     81    $neb->find_instances("foo");
    7582};
    76 like( $@, qr/no instances found/, "storage object does not exist" );
     83like($@, qr/no instances found/, "storage object does not exist");
    7784
    7885Test::Nebulous->setup;
     
    8188    $neb->find_instances();
    8289};
    83 like( $@, qr/1 - 2 were expected/, "no params" );
     90like($@, qr/1 - 2 were expected/, "no params");
    8491
    8592Test::Nebulous->setup;
    8693
    8794eval {
    88     $neb->find_instances( "foo", 'read', 3 );
     95    $neb->find_instances("foo", 'read', 3);
    8996};
    90 like( $@, qr/1 - 2 were expected/, "too many params" );
     97like($@, qr/1 - 2 were expected/, "too many params");
    9198
    9299Test::Nebulous->cleanup;
Note: See TracChangeset for help on using the changeset viewer.