Skip to content

Commit 53012f1

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "adapt to oslo.log changes"
2 parents 96ae970 + ea07f96 commit 53012f1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

nova/tests/unit/privsep/test_utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# under the License.
1414

1515
import errno
16+
import fixtures
1617
import os
1718
from unittest import mock
1819

@@ -55,6 +56,13 @@ def setUp(self):
5556
self.mock_close = close_patcher.start()
5657
self.mock_unlink = unlink_patcher.start()
5758
random_string_patcher.start()
59+
# as of change Iac1b0891ae584ce4b95964e6cdc0ff2483a4e57d in oslo.log
60+
# oslo.log will now internally call os.write() in its PipeMutex code.
61+
# This causes the mock_write() to be called which breaks some of
62+
# the testcases as we expect mock_write() to be called only
63+
# by the code under test.
64+
self.useFixture(fixtures.MonkeyPatch(
65+
"nova.privsep.utils.LOG", mock.Mock()))
5866

5967
def test_supports_direct_io(self):
6068
self.mock_open.return_value = 3
@@ -85,6 +93,7 @@ def test_supports_direct_io_with_exception_in_write(self):
8593
def test_supports_direct_io_with_exception_in_open(self):
8694
self.mock_open.side_effect = ValueError()
8795

96+
self.mock_open.assert_not_called()
8897
self.assertRaises(ValueError, nova.privsep.utils.supports_direct_io,
8998
'.')
9099

0 commit comments

Comments
 (0)