diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-07-13 23:05:45 -0700 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-07-16 20:33:23 -0700 |
commit | ab820837ee980bbd356158ccfc343dee3053409a (patch) | |
tree | 73945f984fdd33a0849bbf3fb57b6af08b5eba48 | |
parent | eeda3f6b215c16cbb567168cb63d987c65f8a1b9 (diff) |
test_heat: don't waste 2 seconds in unittest
remove duration checks and test with sleep 0
Change-Id: I22516cde56ac3a02358ca9c3e652cead10580d76
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
-rw-r--r-- | tests/unit/orchestrator/test_heat.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/tests/unit/orchestrator/test_heat.py b/tests/unit/orchestrator/test_heat.py index 3dc8ad7e7..19d91c6e8 100644 --- a/tests/unit/orchestrator/test_heat.py +++ b/tests/unit/orchestrator/test_heat.py @@ -183,7 +183,7 @@ class HeatTemplateTestCase(unittest.TestCase): @mock_patch_target_module('op_utils') @mock_patch_target_module('heatclient.client.Client') def test_create_negative(self, mock_heat_client_class, mock_op_utils): - self.template.HEAT_WAIT_LOOP_INTERVAL = interval = 0.2 + self.template.HEAT_WAIT_LOOP_INTERVAL = 0 mock_heat_client = mock_heat_client_class() # get the constructed mock # populate attributes of the constructed mock @@ -196,15 +196,10 @@ class HeatTemplateTestCase(unittest.TestCase): with mock.patch.object(self.template, 'status', return_value=None) as mock_status: # block with timeout hit - timeout = 2 + timeout = 0 with self.assertRaises(RuntimeError) as raised, timer() as time_data: self.template.create(block=True, timeout=timeout) - # ensure runtime is approximately the timeout value - expected_time_low = timeout - interval * 0.2 - expected_time_high = timeout + interval * 0.2 - self.assertTrue(expected_time_low < time_data['delta'] < expected_time_high) - # ensure op_utils was used expected_op_utils_usage += 1 self.assertEqual(mock_op_utils.get_session.call_count, expected_op_utils_usage) @@ -232,11 +227,6 @@ class HeatTemplateTestCase(unittest.TestCase): with self.assertRaises(RuntimeError) as raised, timer() as time_data: self.template.create(block=True, timeout=timeout) - # ensure runtime is approximately two intervals - expected_time_low = interval * 1.8 - expected_time_high = interval * 2.2 - self.assertTrue(expected_time_low < time_data['delta'] < expected_time_high) - # ensure the existing heat_client was used and op_utils was used again self.assertEqual(mock_op_utils.get_session.call_count, expected_op_utils_usage) self.assertEqual(mock_op_utils.get_endpoint.call_count, expected_op_utils_usage) |