summaryrefslogtreecommitdiff
path: root/xt/00_sync.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 /xt/00_sync.t
parentupdate tests (diff)
downloadanyevent-riak-f6ac9dc69c1585ce5b3fd9ffd73aa049237c5ea1.tar.gz
switch to dzil; rename tests; update changelog
Diffstat (limited to 'xt/00_sync.t')
-rw-r--r--xt/00_sync.t39
1 files changed, 39 insertions, 0 deletions
diff --git a/xt/00_sync.t b/xt/00_sync.t
new file mode 100644
index 0000000..a8cf910
--- /dev/null
+++ b/xt/00_sync.t
@@ -0,0 +1,39 @@
+use strict;
+use warnings;
+
+use JSON;
+use Test::More;
+use AnyEvent::Riak;
+
+#plan tests => 4;
+
+my $host = 'http://10.0.0.42:8098';
+my $path = 'riak';
+
+ok my $riak = AnyEvent::Riak->new(
+ host => $host,
+ path => $path,
+ w => 1,
+ dw => 1
+ ),
+ 'create riak object';
+
+ok my $ping = $riak->is_alive()->recv, 'ping: host is alive';
+ok my $buckets =
+ $riak->list_bucket('blog_content_temp', {keys => 'false'})->recv,
+ "fetch bucket list";
+
+my $value = {foo => 1};
+
+ok my ($res, $headers) = $riak->store('foo', $value)->recv,
+ 'set a new key';
+($res, $headers) = $riak->store('foo', $value, {key => 'foo_test'})->recv;
+ok $res, 'stored key foo_test';
+
+ok $res = $riak->fetch('foo', 'foo_test')->recv, 'fetch our new key';
+
+is_deeply $value, $res, 'got same data';
+
+ok $res = $riak->delete( 'foo', 'foo_test' )->recv, 'delete our key';
+
+done_testing;