Skip to content

Commit

Permalink
q-dev: update integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Jun 12, 2024
1 parent 54b9f9b commit 42e062a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions qubes/tests/integ/devices_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_000_list_loop(self):
dev_list = list(self.vm.devices['block'])
found = False
for dev in dev_list:
if dev.name == self.img_path:
if dev.serial == self.img_path:
self.assertTrue(dev.ident.startswith('loop'))
self.assertEqual(dev.mode, 'w')
self.assertEqual(dev.size, 1024 * 1024 * 128)
Expand All @@ -113,7 +113,7 @@ def test_001_list_loop_mounted(self):

dev_list = list(self.vm.devices['block'])
for dev in dev_list:
if dev.name == self.img_path:
if dev.serial == self.img_path:
self.fail(
'Device {} ({}) should not be listed because is mounted'
.format(dev, self.img_path))
Expand All @@ -132,11 +132,11 @@ def test_010_list_dm(self):
found = False
for dev in dev_list:
if dev.ident.startswith('loop'):
self.assertNotEquals(dev.name, self.img_path,
self.assertNotEquals(dev.serial, self.img_path,
"Device {} ({}) should not be listed as it is used in "
"device-mapper".format(dev, self.img_path)
)
elif dev.name == 'test-dm':
elif dev.serial == 'test-dm':
self.assertEqual(dev.mode, 'w')
self.assertEqual(dev.size, 1024 * 1024 * 128)
found = True
Expand All @@ -163,12 +163,12 @@ def test_011_list_dm_mounted(self):
dev_list = list(self.vm.devices['block'])
for dev in dev_list:
if dev.ident.startswith('loop'):
self.assertNotEquals(dev.name, self.img_path,
self.assertNotEquals(dev.serial, self.img_path,
"Device {} ({}) should not be listed as it is used in "
"device-mapper".format(dev, self.img_path)
)
else:
self.assertNotEquals(dev.name, 'test-dm',
self.assertNotEquals(dev.serial, 'test-dm',
"Device {} ({}) should not be listed as it is "
"mounted".format(dev, 'test-dm')
)
Expand All @@ -188,11 +188,11 @@ def test_012_list_dm_delayed(self):
found = False
for dev in dev_list:
if dev.ident.startswith('loop'):
self.assertNotEquals(dev.name, self.img_path,
self.assertNotEquals(dev.serial, self.img_path,
"Device {} ({}) should not be listed as it is used in "
"device-mapper".format(dev, self.img_path)
)
elif dev.name == 'test-dm':
elif dev.serial == 'test-dm':
self.assertEqual(dev.mode, 'w')
self.assertEqual(dev.size, 1024 * 1024 * 128)
found = True
Expand All @@ -218,7 +218,7 @@ def test_013_list_dm_removed(self):
dev_list = list(self.vm.devices['block'])
found = False
for dev in dev_list:
if dev.name == self.img_path:
if dev.serial == self.img_path:
self.assertTrue(dev.ident.startswith('loop'))
self.assertEqual(dev.mode, 'w')
self.assertEqual(dev.size, 1024 * 1024 * 128)
Expand All @@ -242,7 +242,7 @@ def test_020_list_loop_partition(self):
dev_list = list(self.vm.devices['block'])
found = False
for dev in dev_list:
if dev.name == self.img_path:
if dev.serial == self.img_path:
self.assertTrue(dev.ident.startswith('loop'))
self.assertEqual(dev.mode, 'w')
self.assertEqual(dev.size, 1024 * 1024 * 128)
Expand Down Expand Up @@ -271,7 +271,7 @@ def test_021_list_loop_partition_mounted(self):

dev_list = list(self.vm.devices['block'])
for dev in dev_list:
if dev.name == self.img_path:
if dev.serial == self.img_path:
self.fail(
'Device {} ({}) should not be listed because its '
'partition is mounted'
Expand Down Expand Up @@ -318,13 +318,13 @@ def setUp(self):
"udevadm settle".format(path=self.img_path), user="root"))
dev_list = list(self.backend.devices['block'])
for dev in dev_list:
if dev.name == self.img_path:
if dev.serial == self.img_path:
self.device = dev
self.device_ident = dev.ident
break
else:
self.fail('Device for {} in {} not found'.format(
self.img_path, self.backend.name))
self.img_path, self.backend.serial))

def test_000_attach_reattach(self):
ass = qubes.device_protocol.DeviceAssignment(self.backend, self.device_ident)
Expand Down

0 comments on commit 42e062a

Please sign in to comment.