Speed up test_report

Mock sleep in some tests in the test_report UT module so we don't waste
time.

Change-Id: Ib540e00d80bc4ad3929a507b7ba03eb84766a53e
This commit is contained in:
Eric Fried 2019-03-17 15:03:48 -05:00
parent be8af28a4f
commit aaf79d5611
1 changed files with 3 additions and 0 deletions

View File

@ -351,6 +351,7 @@ class TestPutAllocations(SchedulerReportClientTestCase):
mock.call(expected_url, mock.ANY, version='1.28',
global_request_id=self.context.global_id)] * 2)
@mock.patch('time.sleep', new=mock.Mock())
@mock.patch('nova.scheduler.client.report.SchedulerReportClient.put')
def test_put_allocations_retry_gives_up(self, mock_put):
@ -987,6 +988,7 @@ class TestPutAllocations(SchedulerReportClientTestCase):
self.assertTrue(res)
@mock.patch('time.sleep', new=mock.Mock())
def test_claim_resources_fail_due_to_rp_generation_retry_success(self):
get_resp_mock = mock.Mock(status_code=200)
get_resp_mock.json.return_value = {
@ -3663,6 +3665,7 @@ class TestAllocations(SchedulerReportClientTestCase):
],
mock_put.mock_calls)
@mock.patch('time.sleep', new=mock.Mock())
@mock.patch("nova.scheduler.client.report.SchedulerReportClient.put")
@mock.patch("nova.scheduler.client.report.SchedulerReportClient.get")
def test_remove_res_from_alloc_run_out_of_retries(