Avoid timeout from service update notification tests

Since If32bca070185937ef83f689b7163d965a89ec10a some of the service
update notification tests are slow because setting a compute enabled or
disabled makes an RPC call to the given compute service. These tests
does not have the proper RPC setup so that call times out. Since the
notification is still generated the test passes. Waiting for this
timeout steals 16 minutes of test execution time unnecessary.

This patch stubs the RPC call as that is not necessary for the
notification testing and therefore speeds up the tests.

Change-Id: I0269c4bd3da0e58593811b11985deb237eefe59e
This commit is contained in:
Balazs Gibizer 2019-08-12 17:24:14 +02:00
parent 790f628883
commit ce42b6d494
1 changed files with 7 additions and 0 deletions

View File

@ -49,6 +49,13 @@ class TestServiceUpdateNotificationSamplev2_52(TestServiceNotificationBase):
test_services.fake_service_get_by_host_binary)
self.stub_out("nova.db.api.service_update",
test_services.fake_service_update)
# NOTE(gibi): enable / disable a compute service tries to call
# the compute service via RPC to update placement. However in these
# tests the compute services are faked. So stub out the RPC call to
# avoid waiting for the RPC timeout. The notifications are generated
# regardless of the result of the RPC call anyhow.
self.stub_out("nova.compute.rpcapi.ComputeAPI.set_host_enabled",
lambda *args, **kwargs: None)
self.useFixture(utils_fixture.TimeFixture(test_services.fake_utcnow()))
self.useFixture(fixtures.SingleCellSimple())
self.service_uuid = test_services.fake_service_get_by_host_binary(