diff options
Diffstat (limited to 'test/integration.rb')
-rw-r--r-- | test/integration.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/integration.rb b/test/integration.rb index 548cb02..cd63c3c 100644 --- a/test/integration.rb +++ b/test/integration.rb @@ -4,6 +4,8 @@ require 'test/unit' require 'securerandom' require 'tempfile' require 'digest' +require 'stringio' +require 'pp' require 'mogilefs' class TestMogIntegration < Test::Unit::TestCase @@ -19,11 +21,21 @@ class TestMogIntegration < Test::Unit::TestCase @trackers = ENV["MOG_TEST_TRACKERS"].split(/,/) now = Time.now domain = "rbmogtest#{now.strftime('%Y%m%d%H%M%S')}.#{uuid}" - mogadm!("domain", "add", domain) - sleep 4 # wait for monitor to refresh caches + @admin = MogileFS::Admin.new(:hosts => @trackers) + @admin.create_domain(domain) + yield_for_monitor_update do + @admin.get_domains.include?(domain) and break + end @domain = domain end + def yield_for_monitor_update # mogilefsd should update every 4 seconds + 50.times do + yield + sleep 0.1 + end + end + def mogadm(*args) x("mogadm", "--trackers=#{@trackers.join(',')}", *args) end @@ -69,7 +81,10 @@ class TestMogIntegration < Test::Unit::TestCase p [ :delete, key ] if $VERBOSE client.delete(key) } - mogadm!("domain", "delete", @domain) + assert_equal true, @admin.delete_domain(@domain) + assert_raises(MogileFS::Backend::DomainNotFoundError) do + @admin.delete_domain(@domain) + end end @to_close.each do |io| io.closed? or io.close |