From 35d1b0e734c90b53883c79dbf411a45601d1b068 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 3 Mar 2022 14:08:57 -0700 Subject: [PATCH] task.tests: Use job_status module Previously this task had an embarrassing "status=fail, success=true" bug. Signed-off-by: Zack Cerza --- teuthology/task/tests/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/teuthology/task/tests/__init__.py b/teuthology/task/tests/__init__.py index a510a4a1cc..088e84483e 100644 --- a/teuthology/task/tests/__init__.py +++ b/teuthology/task/tests/__init__.py @@ -14,6 +14,8 @@ An example:: import logging import pytest +from teuthology.job_status import set_status + log = logging.getLogger(__name__) @@ -92,12 +94,12 @@ def task(ctx, config): plugins=[TeuthologyContextPlugin(ctx, config)] ) except Exception: - log.exception("Saw failure running pytest") - ctx.summary["status"] = "dead" + log.exception("Saw non-test failure!") + set_status(ctx.summary, "dead") else: if status == 0: log.info("OK. All tests passed!") - ctx.summary["status"] = "pass" + set_status(ctx.summary, "pass") else: log.error("FAIL. Saw test failures...") - ctx.summary["status"] = "fail" + set_status(ctx.summary, "fail") -- 2.39.5