test/sgdisk: delete sectorsize from expected data if not in output

The `sfdisk` tool on RHEL-8 does not include the `sectorsize` in its
output when we are testing the `sgdisk` stage. As a result, the test
case fails, because the expected and actual output differs. Modify the
test to delete the `sectorsize` key from the expected output if it is
not present in the actual output.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2023-05-24 16:59:06 +02:00 committed by Simon de Vlieger
parent 560fcc099d
commit 66301ae5c3

View file

@ -458,6 +458,12 @@ class TestStages(test.TestBase):
for p in table["partitions"]:
p["node"] = os.path.basename(p["node"])
# Old versions of sfdisk (e.g. on RHEL-8), do not include
# the 'sectorsize' in the output, so we delete it from the
# expected output if it is not present in the actual output
if "sectorsize" not in table:
del want["partitiontable"]["sectorsize"]
self.assertEqual(have, want)
# cache the downloaded data for the files source