diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-06-21 03:34:28 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-06-25 22:05:48 +0000 |
commit | 328623972837345dbcf3ed372293201e3bc4fe3c (patch) | |
tree | e3385166859612c64b1d4e34f44a61e70b91149c /test/mgmt.rb | |
parent | 40f84cd0924958c619d434a9147e7ed2b6abaadc (diff) | |
download | cmogstored-328623972837345dbcf3ed372293201e3bc4fe3c.tar.gz |
This should prevent one class of "accidental" failures. (The sidechannel has never been meant to be secure and exposed to the public).
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" |