Skip to content
Browse files

run tests only if a server is available

  • Loading branch information...
1 parent 199ebd2 commit d5356098ad38a6f1f0195ead2af44c66bd1a1168 franck cuny committed
Showing with 10 additions and 6 deletions.
  1. +10 −6 t/basic.t
View
16 t/basic.t
@@ -5,12 +5,16 @@ use JSON::XS;
use Test::Exception;
use AnyEvent::Riak;
-my $jiak = AnyEvent::Riak->new(
- host => 'http://127.0.0.1:8098',
-
- #host => 'http://192.168.0.11:8098',
- path => 'jiak'
-);
+my ($host, $path);
+BEGIN {
+ my $riak_test = $ENV{RIAK_TEST_SERVER};
+ ( $host, $path ) = split ";", $riak_test if $riak_test;
+ plan skip_all =>
+ 'set $ENV{RIAK_TEST_SERVER} like this http://127.0.0.1:8098;jiak if you want to run the tests'
+ unless ( $host && $path );
+}
+
+my $jiak = AnyEvent::Riak->new( host => $host, path => $path );
ok my $buckets = $jiak->list_bucket('bar')->recv, "... fetch bucket list";
is scalar @{ $buckets->{keys} }, '0', '... no keys';

0 comments on commit d535609

Please sign in to comment.
Something went wrong with that request. Please try again.