From deb3ae828ea88090931c4cfe47957ae044f18ca8 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Thu, 10 Feb 2022 15:37:17 -0700 Subject: 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. --- tests/integration_tests/modules/test_disk_setup.py | 21 ++++++++++++++++----- 1 file 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 -- cgit v1.2.3