From 15b1531f8034f41f8bf4caaa5ac31231446db01d Mon Sep 17 00:00:00 2001 From: Sean Mooney Date: Mon, 11 Sep 2023 14:19:45 +0100 Subject: [PATCH 1/2] adapt to oslo.log changes This change refactors prvisep util test cases to account for the fact that oslo.log now conditionally uses an internal pipe mutex when logging under eventlet. This was added by Iac1b0891ae584ce4b95964e6cdc0ff2483a4e57d which is part of oslo.log 5.3.0 As a result we need to mock all calls to oslo.log in unit tests that are assertign if os.write is called. when the internal pipe mutex is used oslo.log calls os.write when the mutex is released. Related-Bug: #1983863 Change-Id: Id313669df80f9190b79690fff25f8e3fce2a4aca (cherry picked from commit ea07f96eb10a4fb7c4c00cbde34868a3d21b6c22) --- nova/tests/unit/privsep/test_utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nova/tests/unit/privsep/test_utils.py b/nova/tests/unit/privsep/test_utils.py index 887e6dfa8b0..ca2b28e6d03 100644 --- a/nova/tests/unit/privsep/test_utils.py +++ b/nova/tests/unit/privsep/test_utils.py @@ -13,6 +13,7 @@ # under the License. import errno +import fixtures import os from unittest import mock @@ -55,6 +56,13 @@ def setUp(self): self.mock_close = close_patcher.start() self.mock_unlink = unlink_patcher.start() random_string_patcher.start() + # as of change Iac1b0891ae584ce4b95964e6cdc0ff2483a4e57d in oslo.log + # oslo.log will now internally call os.write() in its PipeMutex code. + # This causes the mock_write() to be called which breaks some of + # the testcases as we expect mock_write() to be called only + # by the code under test. + self.useFixture(fixtures.MonkeyPatch( + "nova.privsep.utils.LOG", mock.Mock())) def test_supports_direct_io(self): self.mock_open.return_value = 3 @@ -85,6 +93,7 @@ def test_supports_direct_io_with_exception_in_write(self): def test_supports_direct_io_with_exception_in_open(self): self.mock_open.side_effect = ValueError() + self.mock_open.assert_not_called() self.assertRaises(ValueError, nova.privsep.utils.supports_direct_io, '.') From c1c6d6701b29ab53bfc7cbe9c5a659061f380c95 Mon Sep 17 00:00:00 2001 From: OpenStack Release Bot Date: Thu, 14 Nov 2024 10:43:11 +0000 Subject: [PATCH 2/2] Update .gitreview for unmaintained/2023.1 Change-Id: I0da37bb80626f628b742275e28fd98b262533491 --- .gitreview | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitreview b/.gitreview index 85eb138a7c7..c70b149f43b 100644 --- a/.gitreview +++ b/.gitreview @@ -2,4 +2,4 @@ host=review.opendev.org port=29418 project=openstack/nova.git -defaultbranch=stable/2023.1 +defaultbranch=unmaintained/2023.1