From 975be6497111f6ca7f275bb60623f25a393fb80d Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sat, 8 Jan 2022 22:00:44 +0100 Subject: [PATCH] tests: Remove udevadm settle from test_60_partitioning Should not be necessary anymore now that we're more predictable. --- src/tests/dbus-tests/test_60_partitioning.py | 41 +++----------------- 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/src/tests/dbus-tests/test_60_partitioning.py b/src/tests/dbus-tests/test_60_partitioning.py index 99620f0cf2..94328be385 100644 --- a/src/tests/dbus-tests/test_60_partitioning.py +++ b/src/tests/dbus-tests/test_60_partitioning.py @@ -17,9 +17,7 @@ def _remove_format(self, device): try: device.Format('empty', d, dbus_interface=self.iface_prefix + '.Block') except dbus.exceptions.DBusException: - self.udev_settle() - time.sleep(5) - device.Format('empty', d, dbus_interface=self.iface_prefix + '.Block') + pass def _create_format(self, device, ftype): device.Format(ftype, self.no_options, dbus_interface=self.iface_prefix + '.Block') @@ -28,9 +26,7 @@ def _remove_partition(self, part): try: part.Delete(self.no_options, dbus_interface=self.iface_prefix + '.Partition') except dbus.exceptions.DBusException: - self.udev_settle() - time.sleep(5) - part.Delete(self.no_options, dbus_interface=self.iface_prefix + '.Partition') + pass def test_create_mbr_partition(self): disk = self.get_object('/block_devices/' + os.path.basename(self.vdevs[0])) @@ -55,7 +51,6 @@ def test_create_mbr_partition(self): # create partition path1 = disk.CreatePartition(dbus.UInt64(1024**2), dbus.UInt64(100 * 1024**2), part_type, '', self.no_options, dbus_interface=self.iface_prefix + '.PartitionTable') - self.udev_settle() part = self.bus.get_object(self.iface_prefix, path1) self.assertIsNotNone(part) @@ -103,7 +98,6 @@ def test_create_mbr_partition(self): # create another partition path2 = disk.CreatePartition(dbus.UInt64(1024**2 + (1024**2 + 100 * 1024**2)), dbus.UInt64(100 * 1024**2), part_type, '', self.no_options, dbus_interface=self.iface_prefix + '.PartitionTable') - self.udev_settle() part = self.bus.get_object(self.iface_prefix, path2) self.assertIsNotNone(part) @@ -113,7 +107,6 @@ def test_create_mbr_partition(self): # create yet another partition path3 = disk.CreatePartition(dbus.UInt64(1024**2 + 2 * (1024**2 + 100 * 1024**2)), dbus.UInt64(100 * 1024**2), part_type, '', self.no_options, dbus_interface=self.iface_prefix + '.PartitionTable') - self.udev_settle() part = self.bus.get_object(self.iface_prefix, path3) self.assertIsNotNone(part) @@ -140,7 +133,6 @@ def create_extended_partition(self, ext_options, log_options, part_type=''): # create extended partition ext_path = disk.CreatePartition(dbus.UInt64(1024**2), dbus.UInt64(150 * 1024**2), part_type, '', ext_options, dbus_interface=self.iface_prefix + '.PartitionTable') - self.udev_settle() ext_part = self.bus.get_object(self.iface_prefix, ext_path) self.assertIsNotNone(ext_part) @@ -163,7 +155,6 @@ def create_extended_partition(self, ext_options, log_options, part_type=''): # create logical partition log_path = disk.CreatePartition(dbus.UInt64(1024**2), dbus.UInt64(50 * 1024**2), '', '', log_options, dbus_interface=self.iface_prefix + '.PartitionTable') - self.udev_settle() log_part = self.bus.get_object(self.iface_prefix, log_path) self.assertIsNotNone(log_part) @@ -180,7 +171,6 @@ def create_extended_partition(self, ext_options, log_options, part_type=''): # create one more logical partition log_path2 = disk.CreatePartition(dbus.UInt64(dbus_offset.value + dbus_size.value), dbus.UInt64(50 * 1024**2), '', '', log_options, dbus_interface=self.iface_prefix + '.PartitionTable') - self.udev_settle() log_part2 = self.bus.get_object(self.iface_prefix, log_path2) self.assertIsNotNone(log_part2) @@ -210,7 +200,6 @@ def test_fill_with_primary_partitions(self): # create primary partition path = disk.CreatePartition(dbus.UInt64(offset + i * (offset + size)), dbus.UInt64(size), '', '', options, dbus_interface=self.iface_prefix + '.PartitionTable') - self.udev_settle() part = self.bus.get_object(self.iface_prefix, path) self.assertIsNotNone(part) @@ -241,7 +230,6 @@ def test_create_gpt_partition(self): gpt_type, gpt_name, self.no_options, dbus_interface=self.iface_prefix + '.PartitionTable') - self.udev_settle() part = self.bus.get_object(self.iface_prefix, path) self.assertIsNotNone(part) @@ -376,7 +364,7 @@ def test_create_with_format_auto_type_gpt(self): disk = self.get_object('/block_devices/' + os.path.basename(self.vdevs[0])) self.assertIsNotNone(disk) - # create msdos partition table + # create gpt partition table self._create_format(disk, 'gpt') self.addCleanup(self._remove_format, disk) @@ -414,9 +402,7 @@ def _remove_format(self, device): try: device.Format('empty', d, dbus_interface=self.iface_prefix + '.Block') except dbus.exceptions.DBusException: - self.udev_settle() - time.sleep(5) - device.Format('empty', d, dbus_interface=self.iface_prefix + '.Block') + pass def _create_format(self, device, ftype): device.Format(ftype, self.no_options, dbus_interface=self.iface_prefix + '.Block') @@ -425,9 +411,7 @@ def _remove_partition(self, part): try: part.Delete(self.no_options, dbus_interface=self.iface_prefix + '.Partition') except dbus.exceptions.DBusException: - self.udev_settle() - time.sleep(5) - part.Delete(self.no_options, dbus_interface=self.iface_prefix + '.Partition') + pass def _create_partition(self, disk, start=1024**2, size=100 * 1024**2, fmt='xfs', type=''): if fmt: @@ -439,7 +423,6 @@ def _create_partition(self, disk, start=1024**2, size=100 * 1024**2, fmt='xfs', self.no_options, dbus_interface=self.iface_prefix + '.PartitionTable') - self.udev_settle() part = self.bus.get_object(self.iface_prefix, path) self.assertIsNotNone(part) @@ -457,8 +440,6 @@ def test_delete(self): part.Delete(self.no_options, dbus_interface=self.iface_prefix + '.Partition') - self.udev_settle() - part_name = path.split('/')[-1] disk_name = os.path.basename(self.vdevs[0]) part_syspath = '/sys/block/%s/%s' % (disk_name, part_name) @@ -491,7 +472,6 @@ def test_dos_flags(self): # set boot flag (10000000(2), 128(10), 0x80(16)) part.SetFlags(dbus.UInt64(128), self.no_options, dbus_interface=self.iface_prefix + '.Partition') - self.udev_settle() # test flags value on types dbus_flags = self.get_property(part, '.Partition', 'Flags') @@ -531,7 +511,6 @@ def test_gpt_flags(self): # set legacy BIOS bootable flag (100(2), 4(10), 0x4(16)) part.SetFlags(dbus.UInt64(4), self.no_options, dbus_interface=self.iface_prefix + '.Partition') - self.udev_settle() # test flags value on types dbus_flags = self.get_property(part, '.Partition', 'Flags') @@ -572,7 +551,6 @@ def test_gpt_type(self): home_guid = '933ac7e1-2eb4-4f13-b844-0e14e2aef915' part.SetType(home_guid, self.no_options, dbus_interface=self.iface_prefix + '.Partition') - self.udev_settle() # test flags value on types dbus_type = self.get_property(part, '.Partition', 'Type') @@ -606,7 +584,6 @@ def test_dos_type(self): part_type = '0x8e' # 'Linux LVM' type, see https://en.wikipedia.org/wiki/Partition_type#PID_8Eh part.SetType(part_type, self.no_options, dbus_interface=self.iface_prefix + '.Partition') - self.udev_settle() # test flags value on types dbus_type = self.get_property(part, '.Partition', 'Type') @@ -649,8 +626,6 @@ def test_resize(self): part.Resize(0, self.no_options, dbus_interface=self.iface_prefix + '.Partition') - self.udev_settle() - part_offset.assertEqual(initial_offset) max_size = part_size.value part_size.assertGreater(initial_size) @@ -660,8 +635,6 @@ def test_resize(self): part.Resize(new_size, self.no_options, dbus_interface=self.iface_prefix + '.Partition') - self.udev_settle() - part_offset.assertEqual(initial_offset) # resize should guarantee at least the requested size part_size.assertGreater(new_size - 1) @@ -671,8 +644,6 @@ def test_resize(self): part.Resize(max_size, self.no_options, dbus_interface=self.iface_prefix + '.Partition') - self.udev_settle() - part_offset.assertEqual(initial_offset) part_size.assertGreater(max_size - 1) part_size.assertLess(disk_size.value) @@ -700,8 +671,6 @@ def test_name(self): part.SetName('test', self.no_options, dbus_interface=self.iface_prefix + '.Partition') - self.udev_settle() - # test flags value on types dbus_name = self.get_property(part, '.Partition', 'Name') dbus_name.assertEqual('test')