diff options
Diffstat (limited to 'test/mgmt.rb')
-rw-r--r-- | test/mgmt.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/mgmt.rb b/test/mgmt.rb index deec383..7101245 100644 --- a/test/mgmt.rb +++ b/test/mgmt.rb @@ -290,6 +290,39 @@ class TestMgmt < Test::Unit::TestCase assert_match(%r{ERROR: unknown command}, @client.gets) end + def test_aio_threads_spam + tries = 1000 + @client.write "WTF\r\n" + assert_match(%r{ERROR: unknown command}, @client.gets) + t_yield # wait for threads to spawn + 100.times do |i| + @client.write "server aio_threads = 1\r\n" + assert_equal "\r\n", @client.readpartial(4) + @client.write "server aio_threads = 2\r\n" + assert_equal "\r\n", @client.readpartial(4) + end + end + + def test_giant_devid_skip + max = 16777215 # devid is MEDIUMINT in DB + Dir.mkdir("#@tmpdir/dev#{max}") + Dir.mkdir("#@tmpdir/dev#{max + 1}") + @client.write "watch\n" + lines = [] + + 2.times do # 2 times in case we're slow + begin + line = @client.gets + lines << line + end until line == ".\n" + end + + assert lines.grep(/\b#{max}\b/)[0] + assert_nil lines.grep(/\b#{max + 1}\b/)[0] + assert File.exist?("#@tmpdir/dev#{max}/usage") + assert ! File.exist?("#@tmpdir/dev#{max + 1}/usage") + end + def test_iostat_watch Dir.mkdir("#@tmpdir/dev666") @client.write "watch\n" |