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/57_client_find.t

    r5667 r17756  
    33# Copryight (C) 2004-2005  Joshua Hoblitt
    44#
    5 # $Id: 57_client_find.t,v 1.1 2005-12-03 02:52:31 jhoblitt Exp $
     5# $Id: 57_client_find.t,v 1.2 2008-05-20 03:46:11 jhoblitt Exp $
    66
    77use strict;
     
    1010use Apache::Test qw( -withtestmore );
    1111
    12 plan tests => 4;
     12plan tests => 7;
    1313
    1414use lib qw( ./t ./lib );
     
    3737
    3838{
     39    # key, volume
     40    my $neb = Nebulous::Client->new(
     41        proxy => "http://$hostport/nebulous",
     42    );
     43    my $uri = $neb->create( "foo", "node01" );
     44
     45    my $path = $neb->find( "foo", "node01" );
     46
     47    ok( -e $path, "file exists" );
     48}
     49
     50Test::Nebulous->setup;
     51
     52{
     53    # key, volume does not hold key but this works anyways ans find will fall
     54    # back to looking for ":any"
     55    my $neb = Nebulous::Client->new(
     56        proxy => "http://$hostport/nebulous",
     57    );
     58    my $uri = $neb->create( "foo", "node01" );
     59
     60    my $path = $neb->find( "foo", "node02" );
     61
     62    ok( -e $path, "file exists" );
     63}
     64
     65Test::Nebulous->setup;
     66
     67{
     68    # key, volume :any
     69    my $neb = Nebulous::Client->new(
     70        proxy => "http://$hostport/nebulous",
     71    );
     72    my $uri = $neb->create( "foo", "node01" );
     73
     74    my $path = $neb->find( "foo", ":any" );
     75
     76    ok( -e $path, "file exists" );
     77}
     78
     79Test::Nebulous->setup;
     80
     81{
    3982    my $neb = Nebulous::Client->new(
    4083        proxy => "http://$hostport/nebulous",
     
    4386    my $path = $neb->find( "foo" );
    4487
    45     ok( ! -e $path, "file doesn't exist" );
     88    is($path, undef, "file doesn't exist" );
    4689}
    4790
     
    5598    $neb->find();
    5699};
    57 like( $@, qr/1 was expected/, "no params" );
     100like( $@, qr/1 - 2 were expected/, "no params" );
    58101
    59102Test::Nebulous->setup;
     
    64107    );
    65108
    66     $neb->find( "foo", "bar" );
     109    $neb->find( "foo", "bar", "bong" );
    67110};
    68 like( $@, qr/1 was expected/, "too many params" );
     111like( $@, qr/1 - 2 were expected/, "too many params" );
    69112
    70113Test::Nebulous->cleanup;
Note: See TracChangeset for help on using the changeset viewer.