Changeset 12643
- Timestamp:
- Mar 28, 2007, 11:48:24 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
Nebulous-Server/t/07_server_find_instances.t (modified) (8 diffs)
-
Nebulous/t/07_server_find_instances.t (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/t/07_server_find_instances.t
r10546 r12643 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 07_server_find_instances.t,v 1. 6 2006-12-08 03:29:19jhoblitt Exp $5 # $Id: 07_server_find_instances.t,v 1.7 2007-03-28 21:48:24 jhoblitt Exp $ 6 6 7 7 use strict; 8 8 use warnings FATAL => qw( all ); 9 9 10 use Test::More tests => 7;10 use Test::More tests => 13; 11 11 12 12 use lib qw( ./t ./lib ); … … 14 14 use Nebulous::Server; 15 15 use Nebulous::Util qw( :standard ); 16 use Test::URI; 16 17 use Test::Nebulous; 17 18 … … 26 27 { 27 28 # key 28 my $uri = $neb->create_object( "foo");29 my $uri = $neb->create_object("foo"); 29 30 30 my $locations = $neb->find_instances( "foo");31 my $locations = $neb->find_instances("foo"); 31 32 32 is( $uri, $locations->[0], "URIs match" ); 33 uri_scheme_ok($locations->[0], 'file'); 34 is($uri, $locations->[0], "URIs match"); 33 35 } 34 36 … … 37 39 { 38 40 # 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"); 41 43 42 my $locations = $neb->find_instances( "foo");44 my $locations = $neb->find_instances("foo"); 43 45 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"); 45 49 } 46 50 … … 49 53 { 50 54 # key, volume 51 my $uri = $neb->create_object( "foo");55 my $uri = $neb->create_object("foo"); 52 56 53 my $locations = $neb->find_instances( "foo", "node01");57 my $locations = $neb->find_instances("foo", "node01"); 54 58 55 is( $uri, $locations->[0], "URIs match" ); 59 uri_scheme_ok($locations->[0], 'file'); 60 is($uri, $locations->[0], "URIs match"); 56 61 } 57 62 … … 60 65 { 61 66 # 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"); 64 69 65 my $locations = $neb->find_instances( "foo", "node01");70 my $locations = $neb->find_instances("foo", "node01"); 66 71 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"); 68 75 } 69 76 … … 72 79 73 80 eval { 74 $neb->find_instances( "foo");81 $neb->find_instances("foo"); 75 82 }; 76 like( $@, qr/no instances found/, "storage object does not exist");83 like($@, qr/no instances found/, "storage object does not exist"); 77 84 78 85 Test::Nebulous->setup; … … 81 88 $neb->find_instances(); 82 89 }; 83 like( $@, qr/1 - 2 were expected/, "no params");90 like($@, qr/1 - 2 were expected/, "no params"); 84 91 85 92 Test::Nebulous->setup; 86 93 87 94 eval { 88 $neb->find_instances( "foo", 'read', 3);95 $neb->find_instances("foo", 'read', 3); 89 96 }; 90 like( $@, qr/1 - 2 were expected/, "too many params");97 like($@, qr/1 - 2 were expected/, "too many params"); 91 98 92 99 Test::Nebulous->cleanup; -
trunk/Nebulous/t/07_server_find_instances.t
r10546 r12643 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 07_server_find_instances.t,v 1. 6 2006-12-08 03:29:19jhoblitt Exp $5 # $Id: 07_server_find_instances.t,v 1.7 2007-03-28 21:48:24 jhoblitt Exp $ 6 6 7 7 use strict; 8 8 use warnings FATAL => qw( all ); 9 9 10 use Test::More tests => 7;10 use Test::More tests => 13; 11 11 12 12 use lib qw( ./t ./lib ); … … 14 14 use Nebulous::Server; 15 15 use Nebulous::Util qw( :standard ); 16 use Test::URI; 16 17 use Test::Nebulous; 17 18 … … 26 27 { 27 28 # key 28 my $uri = $neb->create_object( "foo");29 my $uri = $neb->create_object("foo"); 29 30 30 my $locations = $neb->find_instances( "foo");31 my $locations = $neb->find_instances("foo"); 31 32 32 is( $uri, $locations->[0], "URIs match" ); 33 uri_scheme_ok($locations->[0], 'file'); 34 is($uri, $locations->[0], "URIs match"); 33 35 } 34 36 … … 37 39 { 38 40 # 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"); 41 43 42 my $locations = $neb->find_instances( "foo");44 my $locations = $neb->find_instances("foo"); 43 45 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"); 45 49 } 46 50 … … 49 53 { 50 54 # key, volume 51 my $uri = $neb->create_object( "foo");55 my $uri = $neb->create_object("foo"); 52 56 53 my $locations = $neb->find_instances( "foo", "node01");57 my $locations = $neb->find_instances("foo", "node01"); 54 58 55 is( $uri, $locations->[0], "URIs match" ); 59 uri_scheme_ok($locations->[0], 'file'); 60 is($uri, $locations->[0], "URIs match"); 56 61 } 57 62 … … 60 65 { 61 66 # 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"); 64 69 65 my $locations = $neb->find_instances( "foo", "node01");70 my $locations = $neb->find_instances("foo", "node01"); 66 71 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"); 68 75 } 69 76 … … 72 79 73 80 eval { 74 $neb->find_instances( "foo");81 $neb->find_instances("foo"); 75 82 }; 76 like( $@, qr/no instances found/, "storage object does not exist");83 like($@, qr/no instances found/, "storage object does not exist"); 77 84 78 85 Test::Nebulous->setup; … … 81 88 $neb->find_instances(); 82 89 }; 83 like( $@, qr/1 - 2 were expected/, "no params");90 like($@, qr/1 - 2 were expected/, "no params"); 84 91 85 92 Test::Nebulous->setup; 86 93 87 94 eval { 88 $neb->find_instances( "foo", 'read', 3);95 $neb->find_instances("foo", 'read', 3); 89 96 }; 90 like( $@, qr/1 - 2 were expected/, "too many params");97 like($@, qr/1 - 2 were expected/, "too many params"); 91 98 92 99 Test::Nebulous->cleanup;
Note:
See TracChangeset
for help on using the changeset viewer.
