diff --git a/rally/benchmark/engine.py b/rally/benchmark/engine.py index 407898d900..a069f516bc 100644 --- a/rally/benchmark/engine.py +++ b/rally/benchmark/engine.py @@ -167,6 +167,6 @@ class TestEngine(object): def __exit__(self, exc_type, exc_value, exc_traceback): if exc_type is not None: - self.task.update_status(consts.TaskStatus.FAILED) + self.task.set_failed() else: self.task.update_status(consts.TaskStatus.FINISHED) diff --git a/rally/objects/task.py b/rally/objects/task.py index 605d3d358e..7c4c686a05 100644 --- a/rally/objects/task.py +++ b/rally/objects/task.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +from rally import consts from rally import db @@ -46,7 +47,7 @@ class Task(object): self._update({'verification_log': log}) def set_failed(self): - self._update({'failed': True}) + self._update({'failed': True, 'status': consts.TaskStatus.FAILED}) def append_results(self, key, value): db.task_result_create(self.task['uuid'], key, value) diff --git a/tests/benchmark/test_engine.py b/tests/benchmark/test_engine.py index f66313a400..1bebc58bbc 100644 --- a/tests/benchmark/test_engine.py +++ b/tests/benchmark/test_engine.py @@ -221,7 +221,7 @@ class TestEngineTestCase(test.TestCase): s = consts.TaskStatus expected = [ mock.call.update_status(s.TEST_TOOL_BENCHMARKING), - mock.call.update_status(s.FAILED) + mock.call.set_failed(), ] # NOTE(msdubov): Ignore task['uuid'] calls which are used for logging mock_calls = filter(lambda call: '__getitem__' not in call[0], diff --git a/tests/objects/test_task.py b/tests/objects/test_task.py index a33e59e8de..b316305120 100644 --- a/tests/objects/test_task.py +++ b/tests/objects/test_task.py @@ -127,5 +127,5 @@ class TaskTestCase(test.TestCase): task.set_failed() mock_update.assert_called_once_with( self.task['uuid'], - {'failed': True}, + {'failed': True, 'status': 'failed'}, )