Use task.set_failed when task is failed
This method was added a long time ago but was never used. Change-Id: I4127995e97eb6c68bc0ce44a0afbc6bdcdc0d00d Fixes: bug 1276555
This commit is contained in:
parent
b5d24fb395
commit
202e32dbc8
@ -167,6 +167,6 @@ class TestEngine(object):
|
|||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, exc_traceback):
|
def __exit__(self, exc_type, exc_value, exc_traceback):
|
||||||
if exc_type is not None:
|
if exc_type is not None:
|
||||||
self.task.update_status(consts.TaskStatus.FAILED)
|
self.task.set_failed()
|
||||||
else:
|
else:
|
||||||
self.task.update_status(consts.TaskStatus.FINISHED)
|
self.task.update_status(consts.TaskStatus.FINISHED)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from rally import consts
|
||||||
from rally import db
|
from rally import db
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ class Task(object):
|
|||||||
self._update({'verification_log': log})
|
self._update({'verification_log': log})
|
||||||
|
|
||||||
def set_failed(self):
|
def set_failed(self):
|
||||||
self._update({'failed': True})
|
self._update({'failed': True, 'status': consts.TaskStatus.FAILED})
|
||||||
|
|
||||||
def append_results(self, key, value):
|
def append_results(self, key, value):
|
||||||
db.task_result_create(self.task['uuid'], key, value)
|
db.task_result_create(self.task['uuid'], key, value)
|
||||||
|
@ -221,7 +221,7 @@ class TestEngineTestCase(test.TestCase):
|
|||||||
s = consts.TaskStatus
|
s = consts.TaskStatus
|
||||||
expected = [
|
expected = [
|
||||||
mock.call.update_status(s.TEST_TOOL_BENCHMARKING),
|
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
|
# NOTE(msdubov): Ignore task['uuid'] calls which are used for logging
|
||||||
mock_calls = filter(lambda call: '__getitem__' not in call[0],
|
mock_calls = filter(lambda call: '__getitem__' not in call[0],
|
||||||
|
@ -127,5 +127,5 @@ class TaskTestCase(test.TestCase):
|
|||||||
task.set_failed()
|
task.set_failed()
|
||||||
mock_update.assert_called_once_with(
|
mock_update.assert_called_once_with(
|
||||||
self.task['uuid'],
|
self.task['uuid'],
|
||||||
{'failed': True},
|
{'failed': True, 'status': 'failed'},
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user