canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #06503
[Merge] autopkgtest-cloud:testinfo-json-dump into autopkgtest-cloud:master
Tim Andersson has proposed merging autopkgtest-cloud:testinfo-json-dump into autopkgtest-cloud:master.
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~ubuntu-release/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/484293
Add more information to testinfo.json so it can be parsed by developers more easily.
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of autopkgtest-cloud:testinfo-json-dump 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 0b2739b..fc3c807 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
@@ -86,7 +86,14 @@ ARCH_RELEASE_ALLOW_MAPPING = {
FAIL_CODES = (4, 6, 12, 14, 20)
SUCCESS_CODES = (0, 2, 8)
-KEYS_FOR_ADDITIONAL_PARAMS = ["all-proposed", "testname"]
+TEST_INFO_EXTRA_KEYS = [
+ "all-proposed",
+ "testname",
+# "worker-unit",
+# "datacenter",
+# "openstack-flavor",
+# "openstack-image"
+]
# In the case of a tmpfail, look for these strings in the log and if they're
# found, consider this a real failure instead. This is useful if the test
@@ -330,13 +337,36 @@ def request_matches_per_package(package, arch, release, s):
)
+def testinfo_information_injection(
+ testinfo: dict,
+ additional_params: dict,
+ cfg: configparser.ConfigParser,
+ big_package: bool,
+ release: str,
+ architecture: str,
+ test_uuid: str,
+):
+ d["uuid"] = test_uuid
+ for key in TEST_INFO_EXTRA_KEYS:
+ d[key] = additional_params.get(key)
+ d["worker-unit"] = os.environ.get("HOSTNAME")
+ d["datacenter"] = os.environ.get('SECGROUP').split("@")[1].split(".")[0].split("-")[0]
+ d["openstack-flavor"] = cfg.get("package_size_big" if big_package else "package_size_default")
+ d["openstack-image"] = f"adt/ubuntu-{release}-{host_arch(release, architecture)}-server"
+ return d
+
+
def process_output_dir(
dir,
pkgname,
code,
triggers,
test_uuid,
- additional_params: dict = None,
+ additional_params: dict,
+ cfg: configparser.ConfigParser,
+ big_package: bool,
+ release: str,
+ architecture: str,
):
"""Post-process output directory"""
@@ -380,9 +410,15 @@ def process_output_dir(
json_err,
)
d = {}
- d["uuid"] = test_uuid
- for key in KEYS_FOR_ADDITIONAL_PARAMS:
- d[key] = additional_params.get(key)
+ d = testinfo_information_injection(
+ d,
+ additional_params,
+ cfg,
+ big_package,
+ release,
+ architecture,
+ test_uuid,
+ )
with open(os.path.join(dir, "testinfo.json"), "w") as testinfo:
json.dump(d, testinfo, indent=True)
@@ -1170,6 +1206,11 @@ def request(msg):
pkgname,
test_uuid,
).split()
+ # big_pkg = is it in big packages
+ # release is obvious
+ # architecture is *just* arch, so not enough for dc, but perhaps close
+ # host_arch useless
+
if "swiftuser" in params:
private = True
@@ -1396,14 +1437,19 @@ def request(msg):
else:
f.write("%s\n" % params["readable-by"])
+ ####################################
+ # params params params...
+ # params is just the params in the rabbitmq message I believe, so can't get this info from that.
# List of key=value strings to be sent as a rabbitmq msg
# These variables are optional additional parameters users
# can employ when requesting a test which alters the behaviour
additional_parameters = {}
- for key in KEYS_FOR_ADDITIONAL_PARAMS:
+ for key in TEST_INFO_EXTRA_KEYS:
if params.get(key, None) is not None:
additional_parameters[key] = params[key]
+
+ # autopkgtest_checkout = cfg.get("autopkgtest", "checkout_dir").strip()
(testpkg_version, duration, requester) = process_output_dir(
out_dir,
pkgname,
@@ -1411,6 +1457,10 @@ def request(msg):
params.get("triggers", []),
test_uuid,
additional_parameters, # embed additional parameters in testinfo.json
+ cfg,
+ big_pkg,
+ release,
+ architecture,
)
# If two tests for the same package with different triggers finish at the
References