diff mbox series

[OSSTEST,10/16] host reuse fixes: Fix running of steps adhoc

Message ID 20201022164506.1552-11-iwj@xenproject.org (mailing list archive)
State New, archived
Headers show
Series Bugfixes | expand

Commit Message

Ian Jackson Oct. 22, 2020, 4:45 p.m. UTC
When a ts script is run by hand, for adhoc testing, there is no
OSSTEST_TESTID variable in the environment and the script does not
know it's own step number.  Such adhoc runs are not tracked as steps
in the steps table.

For host lifecycle purposes, treat these as ad-hoc out-of-flight uses,
based only on the taskid (which will usually be a person's personal
static task).

Without this, these adhoc runs fail with a constraint violating trying
to insert a flight/job/step row into the host lifecycle table: the
constraint requires the step to be specified but it is NULL.

Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 Osstest/JobDB/Executive.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
index 4fa42e5d..04555113 100644
--- a/Osstest/JobDB/Executive.pm
+++ b/Osstest/JobDB/Executive.pm
@@ -588,7 +588,7 @@  END
     };
 
 
-    if (!defined $flight) {
+    if (!defined $flight || !defined $tstepno) {
 	db_retry($dbh_tests,[], sub {
 	    $insertq->execute($hostname, $ttaskid,
 			      undef,undef,