← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:option_to_stop_test into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:option_to_stop_test into autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/453333
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:option_to_stop_test into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
index 980d63b..9fd8623 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
@@ -106,6 +106,8 @@ TEMPORARY_TEST_FAIL_STRINGS = [
     " has modification time ",
 ]  # clock skew, LP: #1880839
 
+CANCELLED_STRING = "Received signal 15"
+
 # If we repeatedly time out when installing, there's probably a problem with
 # one of the packages' maintainer scripts.
 FAIL_STRINGS_REGEX = [
@@ -1081,6 +1083,21 @@ def request(msg):
                     # this is an 'unknown' result; try three times but fail
                     # properly after that (do not tmpfail)
                     contents = log_contents(out_dir)
+                    if CANCELLED_STRING in contents:
+                        # Check to see if exit was requested with a kill signal
+                        submit_metric(
+                            architecture,
+                            code,
+                            pkgname,
+                            current_region,
+                            False,
+                            release,
+                        )
+                        logging.warning(
+                            "Test run requested to be cancelled, exiting."
+                        )
+                        sys.exit(0)
+
                     logging.warning(
                         "Test run failed with no version. %sLog follows:",
                         retrying,

References