← Back to team overview

sts-sponsors team mailing list archive

[Merge] ~dmascialino/maas-ci/+git/system-tests:write_version_under_test into ~maas-committers/maas-ci/+git/system-tests:master

 

Diego Mascialino has proposed merging ~dmascialino/maas-ci/+git/system-tests:write_version_under_test into ~maas-committers/maas-ci/+git/system-tests:master.

Commit message:
Write version_under_test file

Requested reviews:
  MAAS Committers (maas-committers)

For more details, see:
https://code.launchpad.net/~dmascialino/maas-ci/+git/system-tests/+merge/433550

This will be useful to adding a description in each system-tests Jenkins job execution.
-- 
Your team MAAS Committers is requested to review the proposed merge of ~dmascialino/maas-ci/+git/system-tests:write_version_under_test into ~maas-committers/maas-ci/+git/system-tests:master.
diff --git a/systemtests/fixtures.py b/systemtests/fixtures.py
index d1df6e9..033fa08 100644
--- a/systemtests/fixtures.py
+++ b/systemtests/fixtures.py
@@ -386,9 +386,13 @@ def maas_region(
         maas_already_initialized = lxd.file_exists(
             maas_container, "/var/snap/maas/common/snap_mode"
         )
-        lxd.execute(
+        snap_list = lxd.execute(
             maas_container, ["snap", "list", "maas"]
         )  # just to record which version is running.
+        try:
+            version = snap_list.stdout.split("\n")[1].split()[1]
+        except IndexError:
+            version = ""
         if not maas_already_initialized:
             lxd.execute(
                 maas_container,
@@ -419,11 +423,15 @@ def maas_region(
             ["apt", "install", "--yes", "maas"],
             environment={"DEBIAN_FRONTEND": "noninteractive"},
         )
-        lxd.execute(
+        policy = lxd.execute(
             maas_container,
             ["apt-cache", "policy", "maas"],
             environment={"DEBIAN_FRONTEND": "noninteractive"},
         )  # just to record which version is running.
+        try:
+            version = policy.stdout.split("\n")[1].strip().split(" ")[1][2:]
+        except IndexError:
+            version = ""
 
     if vault:
         maas_vault_status = yaml.safe_load(
@@ -529,6 +537,9 @@ def maas_region(
             credentials["snap_channel"] = config["snap"]["maas_channel"]
         yaml.dump(credentials, fh)
 
+    with open("version_under_test", "w") as fh:
+        fh.write(f"{version}\n")
+
     if o11y := config.get("o11y"):
         AGENT_PATH = "/opt/agent/agent-linux-amd64"
         if not lxd.file_exists(maas_container, AGENT_PATH):

Follow ups