about summary refs log tree commit homepage
path: root/test/test_mogilefs_integration.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-11-07 07:37:56 +0000
committerEric Wong <normalperson@yhbt.net>2011-11-07 07:37:56 +0000
commit5a4650a07f394268884a8dad58fac42f9a9288c5 (patch)
tree9308ed34234834d004c203795a9baa1e0ee74662 /test/test_mogilefs_integration.rb
parentc4e2b81f2493f0a0013ba03c11b74a61f3ca56f6 (diff)
downloadmogilefs-client-5a4650a07f394268884a8dad58fac42f9a9288c5.tar.gz
We'll also be testing some admin commands in there.
Diffstat (limited to 'test/test_mogilefs_integration.rb')
-rw-r--r--test/test_mogilefs_integration.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test_mogilefs_integration.rb b/test/test_mogilefs_integration.rb
new file mode 100644
index 0000000..bb2cf6e
--- /dev/null
+++ b/test/test_mogilefs_integration.rb
@@ -0,0 +1,24 @@
+# -*- encoding: binary -*-
+require './test/integration'
+
+class TestMogileFSIntegration < TestMogIntegration
+  def setup
+    super
+    @client = MogileFS::MogileFS.new(:hosts => @trackers, :domain => @domain)
+  end
+
+  def test_CRUD
+    assert_equal 4, @client.store_content("CRUD", "default", "DATA")
+    assert_equal "DATA", @client.get_file_data("CRUD")
+    sio = StringIO.new("")
+    rv = @client.get_file_data("CRUD") do |rd|
+      MogileFS::X.copy_stream(rd, sio)
+    end
+    assert_equal 4, rv
+    assert_equal "DATA", sio.string
+    assert_equal 8, @client.store_content("CRUD", "default", "MOARDATA")
+    assert_equal "MOARDATA", @client.get_file_data("CRUD")
+    assert_equal true, @client.delete("CRUD")
+    assert_raises(MogileFS::Backend::UnknownKeyError) { @client.delete("CRUD") }
+  end
+end