]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
tests: don't validate respawn as part of ovsdb monitor functional test
authorIhar Hrachyshka <ihrachys@redhat.com>
Thu, 17 Sep 2015 13:20:51 +0000 (15:20 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Mon, 21 Sep 2015 15:56:43 +0000 (17:56 +0200)
It's already validated by AsyncProcess functional test suite. Instead,
just validate that the monitor generates the initial output, as
expected.

The test is still useful to validate that rootwrap filter works, so
not removing it completely.

Change-Id: I320edaaa2b210e4b34678c60deb31c4875eea298
Closes-Bug: #1495937

neutron/tests/functional/agent/linux/test_ovsdb_monitor.py

index 53a074ccd5012d96f6fbd1505dae3a92a70e98d7..c2d5db446e00f6ca6ffb09731b3b04f28327d169 100644 (file)
@@ -22,9 +22,6 @@ Tests in this module will be skipped unless:
  - sudo testing is enabled (see neutron.tests.functional.base for details)
 """
 
-import signal
-
-import eventlet
 from oslo_config import cfg
 
 from neutron.agent.linux import ovsdb_monitor
@@ -69,28 +66,16 @@ class TestOvsdbMonitor(BaseMonitorTest):
         self.addCleanup(self.monitor.stop)
         self.monitor.start()
 
-    def collect_initial_output(self):
-        while True:
-            output = list(self.monitor.iter_stdout())
-            if output:
-                # Output[0] is header row with spaces for column separation.
-                # The column widths can vary depending on the data in the
-                # columns, so compress multiple spaces to one for testing.
-                return ' '.join(output[0].split())
-            eventlet.sleep(0.01)
-
-    def test_killed_monitor_respawns(self):
-        self.monitor.respawn_interval = 0
-        old_pid = self.monitor._process.pid
-        output1 = self.collect_initial_output()
-        pid = utils.get_root_helper_child_pid(old_pid, run_as_root=True)
-        self.monitor._kill_process(pid, signal.SIGKILL)
-        self.monitor._reset_queues()
-        while (self.monitor._process.pid == old_pid):
-            eventlet.sleep(0.01)
-        output2 = self.collect_initial_output()
-        # Initial output should appear twice
-        self.assertEqual(output1, output2)
+    def collect_monitor_output(self):
+        output = list(self.monitor.iter_stdout())
+        if output:
+            # Output[0] is header row with spaces for column separation.
+            # Use 'other_config' as an indication of the table header.
+            self.assertIn('other_config', output[0])
+            return True
+
+    def test_monitor_generates_initial_output(self):
+        utils.wait_until_true(self.collect_monitor_output, timeout=30)
 
 
 class TestSimpleInterfaceMonitor(BaseMonitorTest):