summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2022-02-10 15:37:17 -0700
committerGitHub <noreply@github.com>2022-02-10 15:37:17 -0700
commitdeb3ae828ea88090931c4cfe47957ae044f18ca8 (patch)
tree8c8fb71ad529f02eef6f5a35e64060b47ff46288
parent8d96687e558d87fd767bdba9dff71e406f9bcf39 (diff)
downloadvyos-cloud-init-deb3ae828ea88090931c4cfe47957ae044f18ca8.tar.gz
vyos-cloud-init-deb3ae828ea88090931c4cfe47957ae044f18ca8.zip
tests: lsblk --json output changes mountpoint key to mountpoinst [] (#1261)
Ubuntu Jammy output from lsblk --json now contains 'mountpoints': [...] instead of 'mountpoint' for children devs. Let our integration test handle either case.
-rw-r--r--tests/integration_tests/modules/test_disk_setup.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/integration_tests/modules/test_disk_setup.py b/tests/integration_tests/modules/test_disk_setup.py
index 76c132ad..7aaba7db 100644
--- a/tests/integration_tests/modules/test_disk_setup.py
+++ b/tests/integration_tests/modules/test_disk_setup.py
@@ -70,9 +70,13 @@ class TestDeviceAliases:
sdb = [x for x in lsblk["blockdevices"] if x["name"] == "sdb"][0]
assert len(sdb["children"]) == 2
assert sdb["children"][0]["name"] == "sdb1"
- assert sdb["children"][0]["mountpoint"] == "/mnt1"
assert sdb["children"][1]["name"] == "sdb2"
- assert sdb["children"][1]["mountpoint"] == "/mnt2"
+ if "mountpoint" in sdb["children"][0]:
+ assert sdb["children"][0]["mountpoint"] == "/mnt1"
+ assert sdb["children"][1]["mountpoint"] == "/mnt2"
+ else:
+ assert sdb["children"][0]["mountpoints"] == ["/mnt1"]
+ assert sdb["children"][1]["mountpoints"] == ["/mnt2"]
result = client.execute("mount -a")
assert result.return_code == 0
assert result.stdout.strip() == ""
@@ -137,9 +141,13 @@ class TestPartProbeAvailability:
sdb = [x for x in lsblk["blockdevices"] if x["name"] == "sdb"][0]
assert len(sdb["children"]) == 2
assert sdb["children"][0]["name"] == "sdb1"
- assert sdb["children"][0]["mountpoint"] == "/mnt1"
assert sdb["children"][1]["name"] == "sdb2"
- assert sdb["children"][1]["mountpoint"] == "/mnt2"
+ if "mountpoint" in sdb["children"][0]:
+ assert sdb["children"][0]["mountpoint"] == "/mnt1"
+ assert sdb["children"][1]["mountpoint"] == "/mnt2"
+ else:
+ assert sdb["children"][0]["mountpoints"] == ["/mnt1"]
+ assert sdb["children"][1]["mountpoints"] == ["/mnt2"]
# Not bionic because the LXD agent gets in the way of us
# changing the userdata
@@ -183,7 +191,10 @@ class TestPartProbeAvailability:
sdb = [x for x in lsblk["blockdevices"] if x["name"] == "sdb"][0]
assert len(sdb["children"]) == 1
assert sdb["children"][0]["name"] == "sdb1"
- assert sdb["children"][0]["mountpoint"] == "/mnt3"
+ if "mountpoint" in sdb["children"][0]:
+ assert sdb["children"][0]["mountpoint"] == "/mnt3"
+ else:
+ assert sdb["children"][0]["mountpoints"] == ["/mnt3"]
def test_disk_setup_no_partprobe(
self, create_disk, client: IntegrationInstance