Skip to content

Commit 2e0bfb1

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "[py313-threading]Skip eventlet specific tests"
2 parents 206b850 + 5226adc commit 2e0bfb1

3 files changed

Lines changed: 20 additions & 32 deletions

File tree

nova/tests/unit/test_rpc.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from nova import context
2323
from nova import rpc
2424
from nova import test
25+
from nova import utils
2526

2627
CONF = nova.conf.CONF
2728

@@ -245,31 +246,9 @@ def test_get_server(self, mock_get, mock_ser, mock_TRANSPORT):
245246

246247
mock_ser.assert_called_once_with('foo')
247248
access_policy = dispatcher.DefaultRPCAccessPolicy
249+
exc = 'threading' if utils.concurrency_mode_threading() else 'eventlet'
248250
mock_get.assert_called_once_with(mock_TRANSPORT, tgt, ends,
249-
executor='eventlet', serializer=ser,
250-
access_policy=access_policy)
251-
self.assertEqual('server', server)
252-
253-
@mock.patch(
254-
'nova.utils.concurrency_mode_threading',
255-
new=mock.Mock(return_value=True))
256-
@mock.patch.object(rpc, 'TRANSPORT')
257-
@mock.patch.object(rpc, 'profiler', None)
258-
@mock.patch.object(rpc, 'RequestContextSerializer')
259-
@mock.patch.object(messaging, 'get_rpc_server')
260-
def test_get_server_threading(self, mock_get, mock_ser, mock_TRANSPORT):
261-
ser = mock.Mock()
262-
tgt = mock.Mock()
263-
ends = mock.Mock()
264-
mock_ser.return_value = ser
265-
mock_get.return_value = 'server'
266-
267-
server = rpc.get_server(tgt, ends, serializer='foo')
268-
269-
mock_ser.assert_called_once_with('foo')
270-
access_policy = dispatcher.DefaultRPCAccessPolicy
271-
mock_get.assert_called_once_with(mock_TRANSPORT, tgt, ends,
272-
executor='threading', serializer=ser,
251+
executor=exc, serializer=ser,
273252
access_policy=access_policy)
274253
self.assertEqual('server', server)
275254

nova/tests/unit/test_utils.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,12 @@ def _task_running(self):
15781578
utils, 'concurrency_mode_threading', new=mock.Mock(return_value=False))
15791579
@mock.patch.object(utils.LOG, 'debug')
15801580
def test_stats_logged_eventlet(self, mock_debug):
1581+
env = os.environ.get('OS_NOVA_DISABLE_EVENTLET_PATCHING', '').lower()
1582+
if env in ('1', 'true', 'yes'):
1583+
self.skipTest(
1584+
"In native threading mode this case is covered by "
1585+
"test_stats_logged_threading")
1586+
15811587
# ensure that each task submission triggers stats printing
15821588
self.flags(thread_pool_statistic_period=0)
15831589

@@ -1613,6 +1619,11 @@ def cleanup():
16131619
utils, 'concurrency_mode_threading', new=mock.Mock(return_value=True))
16141620
@mock.patch.object(utils.LOG, 'debug')
16151621
def test_stats_logged_threading(self, mock_debug):
1622+
if not utils.concurrency_mode_threading():
1623+
self.skipTest(
1624+
"In eventlet mode this case is covered by "
1625+
"test_stats_logged_eventlet")
1626+
16161627
# ensure that each task submission triggers stats printing
16171628
self.flags(thread_pool_statistic_period=0)
16181629
# make the tasks sequential to help simulating queued task
@@ -1687,6 +1698,12 @@ def reset():
16871698

16881699
@mock.patch('oslo_service.backend.init_backend')
16891700
def test_eventlet_selected(self, init_backend):
1701+
env = os.environ.get('OS_NOVA_DISABLE_EVENTLET_PATCHING', '').lower()
1702+
if env in ('1', 'true', 'yes'):
1703+
self.skipTest(
1704+
"In native threading mode this is covered by "
1705+
"test_threading_selected*")
1706+
16901707
monkey_patch.patch()
16911708

16921709
init_backend.assert_called_once_with(oslo_backend.BackendType.EVENTLET)

threading_unit_test_excludes.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,3 @@ nova.tests.unit.api.openstack.compute.test_services.ServicesTestV275.test_servic
1616
# not from nova.compute.api.HostAPI._service_get_all_cells but from the db api
1717
# _instance_get_by_uuid
1818
nova.tests.unit.conductor.test_conductor.ConductorTaskRPCAPITestCase.test_evacuate_old_rpc_without_target_state
19-
20-
21-
# This test has an eventlet and a threading version we
22-
# should either combine them and make the dynamic or
23-
# have the two variant executed conditionally
24-
nova.tests.unit.test_rpc.TestRPC.test_get_server
25-
nova.tests.unit.test_utils.ExecutorStatsTestCase.test_stats_logged_eventlet
26-
nova.tests.unit.test_utils.OsloServiceBackendSelectionTestCase.test_eventlet_selected

0 commit comments

Comments
 (0)