Do not assume order of mounts in execute_with_mount
This fixes the unit tests[1] that breaks with a randomized PYTHONHASHSEED (see the bug report). The test assumed that the execute_with_mount method[2] performs filesystem mounts in a particular order. Found with PYTHONHASHSEED=1. The fix refactors the test case to handle unsorted mounts. [1] neutron_vpnaas.tests.unit.services.vpn.common.test_netns_wrapper.\ TestNetnsWrapper.test_netns_wrap [2] neutron_vpnaas.services.vpn.common.netns_wrapper Partial-bug: #1348818 Note: There are several other unrelated unit tests that also break with a randomized PYTHONHASHSEED, but they are not addressed here. They will be addressed in separate patches. Change-Id: I164c477f32c6781e9974d4d13a4f91a15b99201c
This commit is contained in:
parent
a953c3585e
commit
40c004f987
|
@ -68,7 +68,7 @@ class TestNetnsWrapper(base.BaseTestCase):
|
|||
exp_calls = [mock.call(['mount', '--bind', '/dir/foo', '/foo']),
|
||||
mock.call(['mount', '--bind', '/dir/var', '/var']),
|
||||
mock.call('ls,-al')]
|
||||
self.execute.assert_has_calls(exp_calls, any_order=False)
|
||||
self.execute.assert_has_calls(exp_calls, any_order=True)
|
||||
self.assertFalse(return_val)
|
||||
|
||||
def test_netns_wrap_fail_without_cmd(self):
|
||||
|
|
Loading…
Reference in New Issue