IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 19, 2008, 5:46:11 PM (18 years ago)
Author:
jhoblitt
Message:

change Nebulous::Client->find() to handle a volume param and to fall back to searching on the ':any' volume if the first search fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/t/56_client_find_instances.t

    r5667 r17756  
    33# Copryight (C) 2004-2005  Joshua Hoblitt
    44#
    5 # $Id: 56_client_find_instances.t,v 1.1 2005-12-03 02:52:31 jhoblitt Exp $
     5# $Id: 56_client_find_instances.t,v 1.2 2008-05-20 03:46:11 jhoblitt Exp $
    66
    77use strict;
     
    1010use Apache::Test qw( -withtestmore );
    1111
    12 plan tests => 19;
     12plan tests => 29;
    1313
    1414use lib qw( ./t ./lib );
     
    7474
    7575{
     76    # key, volume == undef
     77    my $neb = Nebulous::Client->new(
     78        proxy => "http://$hostport/nebulous",
     79    );
     80    $neb->create( "foo" );
     81
     82    my $locations = $neb->find_instances( "foo", undef );
     83
     84    is( scalar @$locations, 1, "found 1" );
     85    like( @$locations[0], qr/file:/, "URIs match" );
     86    ok( -e _get_file_path( @$locations[0] ), "URI matches file" );
     87}
     88
     89Test::Nebulous->setup;
     90
     91{
     92    # volume/key
     93    my $neb = Nebulous::Client->new(
     94        proxy => "http://$hostport/nebulous",
     95    );
     96    $neb->create( "foo" );
     97
     98    my $locations = $neb->find_instances( "neb://node01/foo");
     99
     100    is( scalar @$locations, 1, "found 1" );
     101    like( @$locations[0], qr/file:/, "URIs match" );
     102    ok( -e _get_file_path( @$locations[0] ), "URI matches file" );
     103}
     104
     105Test::Nebulous->setup;
     106
     107{
     108    # volume/key, volume override
     109    my $neb = Nebulous::Client->new(
     110        proxy => "http://$hostport/nebulous",
     111    );
     112    $neb->create( "foo", "node01" );
     113
     114    my $locations = $neb->find_instances( "neb://node01/foo", "node02" );
     115
     116    is($locations, undef, "no instances on specified volume" );
     117}
     118
     119Test::Nebulous->setup;
     120
     121{
     122    # volume/key, volume override
     123    my $neb = Nebulous::Client->new(
     124        proxy => "http://$hostport/nebulous",
     125    );
     126    $neb->create( "foo", "node01" );
     127
     128    my $locations = $neb->find_instances( "neb://node02/foo", ":any" );
     129
     130    is( scalar @$locations, 1, "found 1" );
     131    like( @$locations[0], qr/file:/, "URIs match" );
     132    ok( -e _get_file_path( @$locations[0] ), "URI matches file" );
     133}
     134
     135Test::Nebulous->setup;
     136
     137{
    76138    # key
    77139    my $neb = Nebulous::Client->new(
Note: See TracChangeset for help on using the changeset viewer.