From 2c24cf070dfc9341462fcba59fab4c6b7b330938 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 3 Jul 2013 07:50:00 +0000 Subject: remove assertion for handling iostat death This only triggered if the (undocumented) --worker-processes option is used. This assertion is no longer valid as of commit d5a52618ca1f9b5d7f6998716fbfe7714f927112 (refactor handling of "server aio_threads = " command) --- cmogstored.c | 2 -- test/mgmt-iostat.rb | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/cmogstored.c b/cmogstored.c index 31d8e64..64b932d 100644 --- a/cmogstored.c +++ b/cmogstored.c @@ -461,8 +461,6 @@ static void process_died(pid_t pid, int status) switch (id) { case MOG_PROC_IOSTAT: - assert(mog_main.worker_processes == 0 && - "master process registered iostat process"); iostat_died(pid, status); return; case MOG_PROC_UPGRADE: diff --git a/test/mgmt-iostat.rb b/test/mgmt-iostat.rb index 905430c..6171ded 100644 --- a/test/mgmt-iostat.rb +++ b/test/mgmt-iostat.rb @@ -3,6 +3,7 @@ # Copyright (C) 2012-2013, Eric Wong # License: GPLv3 or later (see COPYING for details) require 'test/test_helper' +require 'timeout' class TestMgmtIostat < Test::Unit::TestCase TEST_PATH = File.dirname(__FILE__) + ":#{ENV['PATH']}" @@ -37,6 +38,44 @@ class TestMgmtIostat < Test::Unit::TestCase FileUtils.rm_rf(@tmpdir) end + def __test_iostat_dies(workers = false) + Dir.mkdir "#@tmpdir/dev666" + err = Tempfile.new('err') + @pid = fork do + ENV["PATH"] = TEST_PATH + ENV["MOG_IOSTAT_CMD"] = "#{iostat_mock} #{@iostat_pid.path} slow" + $stderr.reopen(err.path, 'a') + @cmd << workers if workers + exec(*@cmd) + end + iostat_pid = nil + Timeout.timeout(30) do + begin + iostat_pid = @iostat_pid.read.to_i + end while iostat_pid == 0 && sleep(0.05) + Process.kill(:TERM, iostat_pid) + end + + expect = %r{iostat done \(pid=#{iostat_pid}, status=\d} + Timeout.timeout(30) do + loop do + stderr = File.read(err.path) + break if stderr =~ expect + sleep 0.05 + end + end + ensure + err.close! + end + + def test_iostat_dies + __test_iostat_dies + end + + def test_iostat_dies_with_workers + __test_iostat_dies("--worker-processes=1") + end + def test_iostat_fast Dir.mkdir "#@tmpdir/dev666" @pid = fork do -- cgit v1.2.3-24-ge0c7