Skip to content

Commit 0bfc558

Browse files
committed
Revert "tests: Remove resolve_device tests involving partition creation"
This reverts commit 3c41385.
1 parent 773e030 commit 0bfc558

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/tests/dbus-tests/test_10_basic.py

+28
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,34 @@ def test_60_resolve_device(self):
318318
self.assertEqual(len(devices), 1)
319319
self.assertIn(object_path, devices)
320320

321+
# create a partition on another device
322+
disk = self.get_object('/block_devices/' + os.path.basename(self.vdevs[2]))
323+
self.assertIsNotNone(disk)
324+
disk.Format('gpt', self.no_options, dbus_interface=self.iface_prefix + '.Block')
325+
self.addCleanup(self._wipe, self.vdevs[2])
326+
part_label = 'PRTLBLX'
327+
path = disk.CreatePartition(dbus.UInt64(1024**2), dbus.UInt64(100 * 1024**2),
328+
'', part_label, self.no_options,
329+
dbus_interface=self.iface_prefix + '.PartitionTable')
330+
part = self.bus.get_object(self.iface_prefix, path)
331+
self.assertIsNotNone(part)
332+
part_uuid = self.get_property_raw(part, '.Partition', 'UUID')
333+
self.assertIsNotNone(part_uuid)
334+
part_name_val = self.get_property_raw(part, '.Partition', 'Name')
335+
self.assertEquals(part_name_val, part_label)
336+
337+
# check that partlabel and partuuid can be resolved
338+
spec = dbus.Dictionary({'partlabel': part_label}, signature='sv')
339+
devices = manager.ResolveDevice(spec, self.no_options)
340+
object_path = '%s/block_devices/%s1' % (self.path_prefix, os.path.basename(self.vdevs[2]))
341+
self.assertEqual(len(devices), 1)
342+
self.assertIn(object_path, devices)
343+
spec = dbus.Dictionary({'partuuid': part_uuid}, signature='sv')
344+
devices = manager.ResolveDevice(spec, self.no_options)
345+
object_path = '%s/block_devices/%s1' % (self.path_prefix, os.path.basename(self.vdevs[2]))
346+
self.assertEqual(len(devices), 1)
347+
self.assertIn(object_path, devices)
348+
321349
def test_80_device_presence(self):
322350
'''Test the debug devices are present on the bus'''
323351
for d in self.vdevs:

0 commit comments

Comments
 (0)