]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Set timeout for functional job
authorJakub Libosvar <libosvar@redhat.com>
Fri, 12 Dec 2014 17:39:56 +0000 (18:39 +0100)
committerJakub Libosvar <libosvar@redhat.com>
Mon, 15 Dec 2014 13:30:53 +0000 (13:30 +0000)
As functional jobs take more time to finish than unit tests and also
there is a chance that test will hang due to system interaction, this
patch sets maximum execution time to 90 seconds per test.

Change-Id: Ib58a1b53ace178e1bf99150628fa5576b079e8bc

neutron/tests/functional/agent/linux/test_async_process.py
neutron/tests/functional/agent/linux/test_ovsdb_monitor.py
tox.ini

index 5e06a3fdbfbc881edf7f14f2bcccde1a141e8eea..aa712d5d6736bc3b6d15bb442ba74e466321ea8b 100644 (file)
@@ -41,29 +41,27 @@ class TestAsyncProcess(base.BaseTestCase):
             eventlet.sleep(0.01)
 
     def test_stopping_async_process_lifecycle(self):
-        with self.assert_max_execution_time():
-            proc = async_process.AsyncProcess(['tail', '-f',
-                                               self.test_file_path])
-            proc.start()
-            self._check_stdout(proc)
-            proc.stop()
+        proc = async_process.AsyncProcess(['tail', '-f',
+                                           self.test_file_path])
+        proc.start()
+        self._check_stdout(proc)
+        proc.stop()
 
-            # Ensure that the process and greenthreads have stopped
-            proc._process.wait()
-            self.assertEqual(proc._process.returncode, -9)
-            for watcher in proc._watchers:
-                watcher.wait()
+        # Ensure that the process and greenthreads have stopped
+        proc._process.wait()
+        self.assertEqual(proc._process.returncode, -9)
+        for watcher in proc._watchers:
+            watcher.wait()
 
     def test_async_process_respawns(self):
-        with self.assert_max_execution_time():
-            proc = async_process.AsyncProcess(['tail', '-f',
-                                               self.test_file_path],
-                                              respawn_interval=0)
-            proc.start()
+        proc = async_process.AsyncProcess(['tail', '-f',
+                                           self.test_file_path],
+                                          respawn_interval=0)
+        proc.start()
 
-            # Ensure that the same output is read twice
-            self._check_stdout(proc)
-            pid = proc._get_pid_to_kill()
-            proc._kill_process(pid)
-            self._check_stdout(proc)
-            proc.stop()
+        # Ensure that the same output is read twice
+        self._check_stdout(proc)
+        pid = proc._get_pid_to_kill()
+        proc._kill_process(pid)
+        self._check_stdout(proc)
+        proc.stop()
index 7d6131ca97cadd31dedacb27916acf5651e3b6e6..4f3403fc721f3d20daae3b3a86fafce577b0857f 100644 (file)
@@ -74,18 +74,17 @@ class TestOvsdbMonitor(BaseMonitorTest):
             eventlet.sleep(0.01)
 
     def test_killed_monitor_respawns(self):
-        with self.assert_max_execution_time():
-            self.monitor.respawn_interval = 0
-            old_pid = self.monitor._process.pid
-            output1 = self.collect_initial_output()
-            pid = self.monitor._get_pid_to_kill()
-            self.monitor._kill_process(pid)
-            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)
+        self.monitor.respawn_interval = 0
+        old_pid = self.monitor._process.pid
+        output1 = self.collect_initial_output()
+        pid = self.monitor._get_pid_to_kill()
+        self.monitor._kill_process(pid)
+        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)
 
 
 class TestSimpleInterfaceMonitor(BaseMonitorTest):
@@ -104,7 +103,6 @@ class TestSimpleInterfaceMonitor(BaseMonitorTest):
         self.assertFalse(self.monitor.has_updates,
                          'has_updates without port addition should be False')
         self.create_resource('test-port-', self.bridge.add_port)
-        with self.assert_max_execution_time():
-            # has_updates after port addition should become True
-            while not self.monitor.has_updates:
-                eventlet.sleep(0.01)
+        # has_updates after port addition should become True
+        while not self.monitor.has_updates:
+            eventlet.sleep(0.01)
diff --git a/tox.ini b/tox.ini
index bff56a7ffc90e42e5df0987fced174d57e713028..858999c09b84be3ec736b422496ce9e6439c835e 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -26,12 +26,14 @@ setenv = VIRTUAL_ENV={envdir}
 
 [testenv:functional]
 setenv = OS_TEST_PATH=./neutron/tests/functional
+         OS_TEST_TIMEOUT=90
 
 [testenv:dsvm-functional]
 setenv = OS_TEST_PATH=./neutron/tests/functional
          OS_SUDO_TESTING=1
          OS_ROOTWRAP_CMD=sudo /usr/local/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
          OS_FAIL_ON_MISSING_DEPS=1
+         OS_TEST_TIMEOUT=90
 sitepackages=True
 
 [tox:jenkins]