about summary refs log tree commit homepage
path: root/test/test_mogilefs_integration.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-03-22 21:44:17 +0000
committerEric Wong <normalperson@yhbt.net>2012-03-22 21:44:17 +0000
commitd18a8b31a573feaec3da7ce292440eee628f464f (patch)
tree6f27ca0a4b26f04b6433c35df1c41b59b063c2ea /test/test_mogilefs_integration.rb
parentd5718e3ebeae61409bd5e260b8355ea68685ae84 (diff)
downloadmogilefs-client-d18a8b31a573feaec3da7ce292440eee628f464f.tar.gz
This changes the class associated with +key+.
This is _not_ the same as the "update_class" admin command
which actually modifies the class itself.
Diffstat (limited to 'test/test_mogilefs_integration.rb')
-rw-r--r--test/test_mogilefs_integration.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_mogilefs_integration.rb b/test/test_mogilefs_integration.rb
index ba9ffbb..4882cce 100644
--- a/test/test_mogilefs_integration.rb
+++ b/test/test_mogilefs_integration.rb
@@ -290,4 +290,25 @@ class TestMogileFSIntegration < TestMogIntegration
 
     assert_equal "HIHI", @client.get_file_data("unlinked")
   end
+
+  def test_updateclass
+    admin = MogileFS::Admin.new(:hosts => @trackers)
+    admin.create_class(@domain, "one", 1)
+    admin.create_class(@domain, "two", 2)
+    4.times { admin.clear_cache }
+
+    assert_equal 4, @client.store_content("uc", "default", "DATA")
+    assert_equal true, @client.updateclass("uc", "one")
+    assert_equal true, @client.updateclass("uc", "two")
+    assert_raises(MogileFS::Backend::ClassNotFoundError) do
+      @client.updateclass("uc", "wtf")
+    end
+    assert_raises(MogileFS::Backend::InvalidKeyError) do
+      @client.updateclass("nonexistent", "one")
+    end
+
+    @client.delete "uc"
+    admin.delete_class @domain, "one"
+    admin.delete_class @domain, "two"
+  end
 end