← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:preserve-all-proposed into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:preserve-all-proposed 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/453426
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:preserve-all-proposed 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..55d6b81 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
@@ -313,7 +313,7 @@ def request_matches_per_package(package, arch, release, s):
     )
 
 
-def process_output_dir(dir, pkgname, code, triggers):
+def process_output_dir(dir, pkgname, code, triggers, all_proposed):
     """Post-process output directory"""
 
     files = set(os.listdir(dir))
@@ -342,6 +342,16 @@ def process_output_dir(dir, pkgname, code, triggers):
                 d = {"custom_environment": ["ADT_TEST_TRIGGERS=%s" % triggers]}
                 json.dump(d, testinfo, indent=True)
             files.add("testinfo.json")
+        else:
+            # We need to add more info to testinfo.json for the purpose of
+            # users re-queueing tests
+            if all_proposed:
+                d = {}
+                with open(os.path.join(dir, "testinfo.json"), "r") as testinfo:
+                    d = json.loads(testinfo)
+                d["all-proposed"] = 1
+                with open(os.path.join(dir, "testinfo.json"), "w") as testinfo:
+                    json.dump(d, testinfo, indent=True)
 
     with open(os.path.join(dir, "testpkg-version"), "r") as tpv:
         testpkg_version = tpv.read().split()[1]
@@ -1238,7 +1248,7 @@ def request(msg):
                     f.write("%s\n" % params["readable-by"])
 
         (testpkg_version, duration, requester) = process_output_dir(
-            out_dir, pkgname, code, params.get("triggers", [])
+            out_dir, pkgname, code, params.get("triggers", []), "all-proposed" in params
         )
 
         # If two tests for the same package with different triggers finish at the
@@ -1361,6 +1371,7 @@ def request(msg):
             "requester": requester,
             "swift_dir": swift_dir,
             "triggers": triggers,
+            # "all-proposed": 1 if "all-proposed" in params else 0,
         }
     )
     complete_amqp.basic_publish(

References