about summary refs log tree commit homepage
path: root/test/mgmt.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-09-06 19:38:05 -0700
committerEric Wong <normalperson@yhbt.net>2012-09-06 19:38:05 -0700
commit3090c9c6a5d9a7ffdea6c3a97b566ae49f1d39de (patch)
tree4eb45d727e3d93b7533c897dbf19737dd1762eb8 /test/mgmt.rb
parent3f0aa7740cae426a6a1b34a943917ae87d7bc2a5 (diff)
downloadcmogstored-3090c9c6a5d9a7ffdea6c3a97b566ae49f1d39de.tar.gz
The "watch" sidechannel command no longer gets confused in case
two "devXX" directories share the same filesystem (and thus
st_dev).  This case should be rare in production setups, but
happens frequently in testing.

Perl mogstored does not have this bug.
Diffstat (limited to 'test/mgmt.rb')
-rw-r--r--test/mgmt.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/mgmt.rb b/test/mgmt.rb
index a7b6a1a..694547c 100644
--- a/test/mgmt.rb
+++ b/test/mgmt.rb
@@ -247,4 +247,23 @@ class TestMgmt < Test::Unit::TestCase
     assert_equal ".\n", @client.gets
   end if `which iostat 2>/dev/null`.chomp.size != 0 &&
          RUBY_PLATFORM !~ /kfreebsd-gnu/
+
+  def test_iostat_watch_multidir
+    Dir.mkdir("#@tmpdir/dev666")
+    Dir.mkdir("#@tmpdir/dev999")
+    @client.write "watch\n"
+
+    # wait for iostat to catch up
+    3.times { assert_kind_of String, @client.gets }
+    util = RUBY_PLATFORM =~ /linux/ ? %r{\d+\.\d\d} : %r{\d+(?:\.\d+)?}
+    lines = []
+    lines << @client.gets
+    lines << @client.gets
+    assert_match(/^(666|999)\t#{util}\n/, lines[0])
+    assert_match(/^(666|999)\t#{util}\n/, lines[1])
+    assert_not_equal(lines[0], lines[1])
+
+    assert_equal ".\n", @client.gets
+  end if `which iostat 2>/dev/null`.chomp.size != 0 &&
+         RUBY_PLATFORM !~ /kfreebsd-gnu/
 end