tests: don't validate respawn as part of ovsdb monitor functional test

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
This commit is contained in:
Ihar Hrachyshka 2015-09-17 15:20:51 +02:00
parent bdcf8e6079
commit bea2900144
1 changed files with 9 additions and 24 deletions

View 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 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_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 test_monitor_generates_initial_output(self):
utils.wait_until_true(self.collect_monitor_output, timeout=30)
class TestSimpleInterfaceMonitor(BaseMonitorTest):