about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-06-05 23:46:09 +0000
committerEric Wong <normalperson@yhbt.net>2012-06-05 23:46:09 +0000
commit112df6360d87356e03a21e8cc4ae24b49eede95f (patch)
tree6d46da82ab7a7d880d7adc2789e369bd4e3e711b
parent8644022fb9046556d37a51735cad433f382949c1 (diff)
downloadmogilefs-client-112df6360d87356e03a21e8cc4ae24b49eede95f.tar.gz
list_keys needs to raise UnregDomainError on invalid domains.
This regression was introduced in
commit 0b933fc83b8b519c8e587caa6606dd372dda18af
-rw-r--r--lib/mogilefs/mogilefs.rb1
-rw-r--r--test/test_fresh.rb9
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/mogilefs/mogilefs.rb b/lib/mogilefs/mogilefs.rb
index f206810..ba8de2c 100644
--- a/lib/mogilefs/mogilefs.rb
+++ b/lib/mogilefs/mogilefs.rb
@@ -316,6 +316,7 @@ class MogileFS::MogileFS < MogileFS::Client
                              :after => after, :limit => limit,
                              :ruby_no_raise => true)
     MogileFS::Backend::NoneMatchError === res and return
+    raise res if MogileFS::Error === res
 
     keys = (1..res['key_count'].to_i).map { |i| res["key_#{i}"] }
     if block
diff --git a/test/test_fresh.rb b/test/test_fresh.rb
index 7d03c01..b7882cd 100644
--- a/test/test_fresh.rb
+++ b/test/test_fresh.rb
@@ -5,4 +5,13 @@ class TestMogFresh < Test::Unit::TestCase
   include TestFreshSetup
   alias setup setup_mogilefs
   alias teardown teardown_mogilefs
+
+  def test_list_keys_invalid_domain
+    add_host_device_domain
+    domain = @domain + ".non-existent"
+    client = MogileFS::MogileFS.new :hosts => @hosts, :domain => domain
+    assert_raises(MogileFS::Backend::UnregDomainError) do
+      client.list_keys
+    end
+  end
 end