about summary refs log tree commit homepage
path: root/test/test_mogilefs_integration.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-01-16 03:09:09 +0000
committerEric Wong <e@80x24.org>2015-01-16 03:10:07 +0000
commit63cc3ee529250a6b09dd7e032dc73ec509000c0f (patch)
tree564f21756c31d3774e6a746661bb2b3699306239 /test/test_mogilefs_integration.rb
parentb1f366f2b764654d0dd1460369531e420b8b988c (diff)
downloadmogilefs-client-63cc3ee529250a6b09dd7e032dc73ec509000c0f.tar.gz
This should make it easier to fully test on machines without
access to an existing MogileFS instance.  You'll still
need mogilefsd and mogstored available, however, but these
tests are skipped on machines without them.
Diffstat (limited to 'test/test_mogilefs_integration.rb')
-rw-r--r--test/test_mogilefs_integration.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/test/test_mogilefs_integration.rb b/test/test_mogilefs_integration.rb
index 3c79308..6d16cd7 100644
--- a/test/test_mogilefs_integration.rb
+++ b/test/test_mogilefs_integration.rb
@@ -1,12 +1,16 @@
 # -*- encoding: binary -*-
-require './test/integration'
+require './test/fresh'
 
-class TestMogileFSIntegration < TestMogIntegration
+class TestMogileFSIntegration < Test::Unit::TestCase
+  include TestFreshSetup
   def setup
-    super
+    setup_mogilefs
+    add_host_device_domain
     @client = MogileFS::MogileFS.new(:hosts => @trackers, :domain => @domain)
   end
 
+  alias teardown teardown_mogilefs
+
   def test_CRUD
     assert ! @client.exist?("CRUD")
     assert_equal 4, @client.store_content("CRUD", "default", "DATA")
@@ -157,9 +161,14 @@ class TestMogileFSIntegration < TestMogIntegration
     end
   end
 
-  # TODO: move this to a fresh instance
   def test_admin_each_fid
     admin = MogileFS::Admin.new(:hosts => @trackers)
+    input = %w(a b c d e)
+    input.each do |k|
+      rv = @client.new_file(k)
+      rv.write(k)
+      assert_nil rv.close
+    end
     seen = {}
     count = admin.each_fid do |info|
       seen[info["fid"]] = true
@@ -171,7 +180,8 @@ class TestMogileFSIntegration < TestMogIntegration
       assert_kind_of String, info["domain"]
     end
     assert_equal count, seen.size
-  end if ENV["TEST_EXPENSIVE"]
+    assert_equal count, input.size
+  end
 
   def test_new_file_no_block
     rv = @client.new_file("no_block")