summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-05-11 11:22:58 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-04 11:09:21 +0200
commitf6ac9dc69c1585ce5b3fd9ffd73aa049237c5ea1 (patch)
treeeb858959a3f12318612055208b447e5f4a9e5a40 /t
parentupdate tests (diff)
downloadanyevent-riak-f6ac9dc69c1585ce5b3fd9ffd73aa049237c5ea1.tar.gz
switch to dzil; rename tests; update changelog
Diffstat (limited to 't')
-rw-r--r--t/10_async.t88
-rw-r--r--t/basic.t102
2 files changed, 0 insertions, 190 deletions
diff --git a/t/10_async.t b/t/10_async.t
deleted file mode 100644
index 9e88280..0000000
--- a/t/10_async.t
+++ /dev/null
@@ -1,88 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use JSON::XS;
-use Test::Exception;
-use AnyEvent::Riak;
-use YAML::Syck;
-
-plan tests => 5;
-
-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} if you want to run the tests'
- unless ($host && $path);
-}
-
-my $bucket = 'test';
-
-ok my $riak = AnyEvent::Riak->new(
- host => $host,
- path => $path,
- w => 1,
- dw => 1
- ),
- 'create riak object';
-
-{
- my $cv = AnyEvent->condvar;
- $cv->begin(sub { $cv->send });
- $cv->begin;
- # ping
- $riak->is_alive(
- callback => sub {
- my $res = shift;
- pass "is alive in cb" if $res;
- $cv->end;
- }
- );
- $cv->end;
- $cv->recv;
-}
-
-{
- my $cv = AnyEvent->condvar;
- $cv->begin(sub { $cv->send });
- $cv->begin;
- # list bucket
- $riak->list_bucket(
- $bucket,
- parameters => {props => 'true', keys => 'true'},
- callback => sub {
- my $res = shift;
- ok $res->{props}, 'got props';
- $cv->end;
- }
- );
- $cv->end;
- $cv->recv;
-}
-
-{
- my $value = {foo => 'bar',};
- my $cv = AnyEvent->condvar;
- $cv->begin(sub { $cv->send });
- $cv->begin;
-
- # store object
- $riak->store(
- $bucket, 'bar3', $value,
- callback => sub {
- pass "store value ok";
- $riak->fetch(
- 'foo', 'bar3',
- callback => sub {
- my $body = shift;
- is_deeply($body, $value, 'value is ok in cb');
- $cv->end;
- }
- );
- }
- );
- $cv->end;
- $cv->recv;
-}
diff --git a/t/basic.t b/t/basic.t
deleted file mode 100644
index 89da815..0000000
--- a/t/basic.t
+++ /dev/null
@@ -1,102 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use JSON::XS;
-use Test::Exception;
-use AnyEvent::Riak;
-use YAML::Syck;
-
-#plan tests => 15;
-
-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} if you want to run the tests'
- unless ( $host && $path );
-}
-
-ok my $riak = AnyEvent::Riak->new( host => $host, path => $path, w => 1,
- dw => 1),
- 'create riak object';
-
-# ping
-ok my $ping_one = $riak->is_alive(
- callback => sub {
- my $res = shift;
- pass "is alive in cb" if $res;
- }
- ),
- 'ping with callback';
-
-ok my $ping_two = $riak->is_alive()->recv, 'ping without callback';
-
-ok my $s = $ping_one->recv, 'response from ping without callback';
-is $s, 1, 'valid response from ping';
-
-# list bucket
-ok my $bucket_cb = $riak->list_bucket(
- 'bar',
- parameters => { props => 'true', keys => 'true' },
- callback => sub {
- my $res = shift;
- ok $res->{props};
- is scalar @{ $res->{keys} }, 0, '0 keys in cb';
- }
- ),
- 'fetch bucket list';
-
-ok my $buckets = $riak->list_bucket('bar')->recv, "fetch bucket list, twice";
-is scalar @{ $buckets->{keys} }, '0', 'no keys';
-
-ok my $res_bucket = $bucket_cb->recv, 'get bucket';
-
-# set bucket
-ok my $new_bucket
- = $riak->set_bucket( 'foo', { props => { n_val => 2 } } )->recv,
- 'set a new bucket';
-
-my $value = {
- foo => 'bar',
-};
-
-ok my $res = $riak->store('foo', 'bar', $value)->recv, 'set a new key';
-
-ok $res = $riak->fetch( 'foo', 'bar' )->recv, 'fetch our new key';
-is_deeply $res, $value, 'value is ok';
-# ok $res = $riak->delete( 'foo', 'bar' )->recv, 'delete our key';
-
-# ok my $store_w_cb = $riak->store(
-# 'foo', 'bar3', $value, undef, undef,
-# sub {
-# pass "store value ok";
-# $riak->fetch(
-# 'foo', 'bar3', undef,
-# sub {
-# my $body = shift;
-# is_deeply (JSON::decode_json($body), $value, 'value is ok in cb');
-# }
-# );
-# }
-# );
-
-# ok my $final_res = $store_w_cb->recv;
-# $final_res->recv; # FIXME all cb should be called at this point
-
-# ok $res = $riak->store($value)->recv, '... set a new key';
-# my $second_value = {
-# bucket => 'foo',
-# key => 'baz',
-# object => { foo => "bar", baz => 2 },
-# links => [ [ 'foo', 'bar', 'tagged' ] ],
-# };
-# ok $res = $riak->store($second_value)->recv, '... set another new key';
-
-# ok $res = $riak->walk( 'foo', 'baz', [ { bucket => 'foo', } ] )->recv,
-# '... walk';
-# is $res->{results}->[0]->[0]->{key}, "bar", "... walked to bar";
-
-done_testing();