about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-07-03 07:50:00 +0000
committerEric Wong <normalperson@yhbt.net>2013-07-10 00:56:26 +0000
commit2c24cf070dfc9341462fcba59fab4c6b7b330938 (patch)
treea400fb4e51613138d8eb9b3ee177a151bc842d9d
parentb600fc854d2a813dc7cf08eb58590ada90db4c02 (diff)
downloadcmogstored-2c24cf070dfc9341462fcba59fab4c6b7b330938.tar.gz
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)
-rw-r--r--cmogstored.c2
-rw-r--r--test/mgmt-iostat.rb39
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 <normalperson@yhbt.net>
 # 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