diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-04-08 04:40:45 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-04-08 04:40:45 +0000 |
commit | f241b072fef158d8371fcb9a17ddde0e3286801e (patch) | |
tree | ae206f6311a755d83e73910112bca1ab10c8cb45 | |
parent | ca06d64d6131de1f3a8bfca87f0620b27c746976 (diff) | |
parent | 31631e82bbf974c50fb913dafe0ad86e2c0e6a8b (diff) | |
download | neutron-f241b072fef158d8371fcb9a17ddde0e3286801e.tar.gz |
Merge "Fix intermittent UT failures in test_utils"
-rw-r--r-- | neutron/tests/functional/agent/linux/test_process_monitor.py | 6 | ||||
-rw-r--r-- | neutron/tests/unit/agent/linux/test_utils.py | 16 |
2 files changed, 6 insertions, 16 deletions
diff --git a/neutron/tests/functional/agent/linux/test_process_monitor.py b/neutron/tests/functional/agent/linux/test_process_monitor.py index 1bf50803fc..51bf796682 100644 --- a/neutron/tests/functional/agent/linux/test_process_monitor.py +++ b/neutron/tests/functional/agent/linux/test_process_monitor.py @@ -12,6 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +import os + from oslo_config import cfg from six import moves @@ -78,6 +80,10 @@ class BaseTestProcessMonitor(base.BaseTestCase): def all_children_active(): return all(pm.active for pm in self._child_processes) + for pm in self._child_processes: + directory = os.path.dirname(pm.get_pid_file_name()) + self.assertEqual(0o755, os.stat(directory).st_mode & 0o777) + # we need to allow extra_time for the check process to happen # and properly execute action over the gone processes under # high load conditions diff --git a/neutron/tests/unit/agent/linux/test_utils.py b/neutron/tests/unit/agent/linux/test_utils.py index a1e1b85f2e..512f1bd778 100644 --- a/neutron/tests/unit/agent/linux/test_utils.py +++ b/neutron/tests/unit/agent/linux/test_utils.py @@ -12,8 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -import os - import mock import socket import testtools @@ -227,20 +225,6 @@ class TestBaseOSUtils(base.BaseTestCase): EGID = 456 EGNAME = 'group' - @mock.patch.object(os.path, 'isdir', return_value=False) - @mock.patch.object(os, 'makedirs') - def test_ensure_dir_not_exist(self, makedirs, isdir): - utils.ensure_dir('/the') - isdir.assert_called_once_with('/the') - makedirs.assert_called_once_with('/the', 0o755) - - @mock.patch.object(os.path, 'isdir', return_value=True) - @mock.patch.object(os, 'makedirs') - def test_ensure_dir_exist(self, makedirs, isdir): - utils.ensure_dir('/the') - isdir.assert_called_once_with('/the') - self.assertFalse(makedirs.called) - @mock.patch('os.geteuid', return_value=EUID) @mock.patch('pwd.getpwuid', return_value=FakeUser(EUNAME)) def test_is_effective_user_id(self, getpwuid, geteuid): |