@@ -918,7 +918,7 @@ def eventCallback(conn, dom, event, detail, opaque):
918918 libvirt .virEventRunDefaultImpl ()
919919 time .sleep (0.1 )
920920
921- assert stop_failed_event
921+ self . assertTrue ( stop_failed_event )
922922 vc .close ()
923923
924924 # In case we would not detect the crash, Libvirt would still show the
@@ -1492,9 +1492,8 @@ def test_live_migration_tls(self):
14921492 set (server_hello )
14931493 ) # creating a set will discard duplicates.
14941494
1495- assert server_hellos == expected
1496- assert tcp_streams == expected
1497-
1495+ self .assertEqual (server_hellos , expected )
1496+ self .assertEqual (tcp_streams , expected )
14981497 wait_for_ssh (dst )
14991498
15001499 def test_live_migration_tls_without_certificates (self ):
@@ -1538,7 +1537,11 @@ def check_certificates(machine):
15381537 expected_files = ["ca-cert.pem" , "server-cert.pem" , "server-key.pem" ]
15391538 files = machine .succeed (f"ls { certificate_dir } " ).strip ()
15401539 for expected_file in expected_files :
1541- assert expected_file in files , f"{ expected_file } not in { files } "
1540+ self .assertIn (
1541+ expected_file ,
1542+ files ,
1543+ f"didn't find file '{ expected_file } ' in '{ certificate_dir } '" ,
1544+ )
15421545
15431546 # We first check case one, then case two (see comment above).
15441547 for remove_cert_dir in [True , False ]:
@@ -1627,42 +1630,47 @@ def test_bdf_implicit_assignment(self):
16271630
16281631 devices = pci_devices_by_bdf (controllerVM )
16291632 # Implicitly added fixed to 0x01
1630- assert devices ["00:01.0" ] == VIRTIO_ENTROPY_SOURCE
1633+ self . assertEqual ( devices ["00:01.0" ], VIRTIO_ENTROPY_SOURCE )
16311634 # Added by XML; dynamic BDF
1632- assert devices ["00:02.0" ] == VIRTIO_NETWORK_DEVICE
1635+ self . assertEqual ( devices ["00:02.0" ], VIRTIO_NETWORK_DEVICE )
16331636 # Add through XML
1634- assert devices ["00:03.0" ] == VIRTIO_BLOCK_DEVICE
1637+ self . assertEqual ( devices ["00:03.0" ], VIRTIO_BLOCK_DEVICE )
16351638 # Defined fixed BDF in XML; Hotplugged
1636- assert devices ["00:04.0" ] == VIRTIO_NETWORK_DEVICE
1639+ self . assertEqual ( devices ["00:04.0" ], VIRTIO_NETWORK_DEVICE )
16371640 # Hotplugged by this test (vdb)
1638- assert devices ["00:05.0" ] == VIRTIO_BLOCK_DEVICE
1641+ self . assertEqual ( devices ["00:05.0" ], VIRTIO_BLOCK_DEVICE )
16391642 # Hotplugged by this test (vdc)
1640- assert devices ["00:06.0" ] == VIRTIO_BLOCK_DEVICE
1643+ self . assertEqual ( devices ["00:06.0" ], VIRTIO_BLOCK_DEVICE )
16411644
16421645 # Check that we can reuse the same non-statically allocated BDF
16431646 hotplug (controllerVM , "virsh detach-disk --domain testvm --target vdb" )
1644- assert pci_devices_by_bdf (controllerVM ).get ("00:05.0" ) is None
1647+
1648+ self .assertIsNone (pci_devices_by_bdf (controllerVM ).get ("00:05.0" ))
16451649 hotplug (
16461650 controllerVM ,
16471651 "virsh attach-disk --domain testvm --target vdb --source /var/lib/libvirt/storage-pools/nfs-share/vdb.img" ,
16481652 )
1649- assert pci_devices_by_bdf (controllerVM ).get ("00:05.0" ) == VIRTIO_BLOCK_DEVICE
1653+ self .assertEqual (
1654+ pci_devices_by_bdf (controllerVM ).get ("00:05.0" ), VIRTIO_BLOCK_DEVICE
1655+ )
16501656
16511657 # We free slot 4 and 5 ...
16521658 hotplug (
16531659 controllerVM ,
16541660 "virsh detach-device testvm /etc/new_interface_explicit_bdf.xml" ,
16551661 )
16561662 hotplug (controllerVM , "virsh detach-disk --domain testvm --target vdb" )
1657- assert pci_devices_by_bdf (controllerVM ).get ("00:04.0" ) is None
1658- assert pci_devices_by_bdf (controllerVM ).get ("00:05.0" ) is None
1663+ self . assertIsNone ( pci_devices_by_bdf (controllerVM ).get ("00:04.0" ))
1664+ self . assertIsNone ( pci_devices_by_bdf (controllerVM ).get ("00:05.0" ))
16591665 # ...and expect the same disk that was formerly attached non-statically to slot 5 now to pop up in slot 4
16601666 # through implicit BDF allocation.
16611667 hotplug (
16621668 controllerVM ,
16631669 "virsh attach-disk --domain testvm --target vdb --source /var/lib/libvirt/storage-pools/nfs-share/vdb.img" ,
16641670 )
1665- assert pci_devices_by_bdf (controllerVM ).get ("00:04.0" ) == VIRTIO_BLOCK_DEVICE
1671+ self .assertEqual (
1672+ pci_devices_by_bdf (controllerVM ).get ("00:04.0" ), VIRTIO_BLOCK_DEVICE
1673+ )
16661674
16671675 # Check that BDFs stay the same after migration
16681676 devices_before_livemig = pci_devices_by_bdf (controllerVM )
@@ -1671,7 +1679,7 @@ def test_bdf_implicit_assignment(self):
16711679 )
16721680 wait_for_ssh (computeVM )
16731681 devices_after_livemig = pci_devices_by_bdf (computeVM )
1674- assert devices_before_livemig == devices_after_livemig
1682+ self . assertEqual ( devices_before_livemig , devices_after_livemig )
16751683
16761684 def test_bdf_explicit_assignment (self ):
16771685 """
@@ -1702,28 +1710,28 @@ def test_bdf_explicit_assignment(self):
17021710 )
17031711
17041712 devices = pci_devices_by_bdf (controllerVM )
1705- assert devices ["00:01.0" ] == VIRTIO_BLOCK_DEVICE
1706- assert devices ["00:02.0" ] == VIRTIO_NETWORK_DEVICE
1707- assert devices .get ("00:03.0" ) is None
1708- assert devices ["00:04.0" ] == VIRTIO_NETWORK_DEVICE
1709- assert devices ["00:05.0" ] == VIRTIO_ENTROPY_SOURCE
1710- assert devices .get ("00:06.0" ) is None
1711- assert devices ["00:17.0" ] == VIRTIO_BLOCK_DEVICE
1713+ self . assertEqual ( devices ["00:01.0" ], VIRTIO_BLOCK_DEVICE )
1714+ self . assertEqual ( devices ["00:02.0" ], VIRTIO_NETWORK_DEVICE )
1715+ self . assertIsNone ( devices .get ("00:03.0" ))
1716+ self . assertEqual ( devices ["00:04.0" ], VIRTIO_NETWORK_DEVICE )
1717+ self . assertEqual ( devices ["00:05.0" ], VIRTIO_ENTROPY_SOURCE )
1718+ self . assertIsNone ( devices .get ("00:06.0" ))
1719+ self . assertEqual ( devices ["00:17.0" ], VIRTIO_BLOCK_DEVICE )
17121720
17131721 # Check that BDF is freed and can be reallocated when de-/attaching a (entirely different) device
17141722 hotplug (
17151723 controllerVM ,
17161724 "virsh detach-device testvm /etc/new_interface_explicit_bdf.xml" ,
17171725 )
17181726 hotplug (controllerVM , "virsh detach-disk --domain testvm --target vdb" )
1719- assert pci_devices_by_bdf (controllerVM ).get ("00:04.0" ) is None
1720- assert pci_devices_by_bdf (controllerVM ).get ("00:17.0" ) is None
1727+ self . assertIsNone ( pci_devices_by_bdf (controllerVM ).get ("00:04.0" ))
1728+ self . assertIsNone ( pci_devices_by_bdf (controllerVM ).get ("00:17.0" ))
17211729 hotplug (
17221730 controllerVM ,
17231731 "virsh attach-disk --domain testvm --target vdb --source /var/lib/libvirt/storage-pools/nfs-share/cirros.img --address pci:0.0.04.0" ,
17241732 )
17251733 devices_before_livemig = pci_devices_by_bdf (controllerVM )
1726- assert devices_before_livemig . get ( "00:04.0" ) == VIRTIO_BLOCK_DEVICE
1734+ self . assertEqual ( devices_before_livemig [ "00:04.0" ], VIRTIO_BLOCK_DEVICE )
17271735
17281736 # Adding to the same bdf twice fails
17291737 hotplug_fail (
@@ -1737,7 +1745,7 @@ def test_bdf_explicit_assignment(self):
17371745 )
17381746 wait_for_ssh (computeVM )
17391747 devices_after_livemig = pci_devices_by_bdf (computeVM )
1740- assert devices_before_livemig == devices_after_livemig
1748+ self . assertEqual ( devices_before_livemig , devices_after_livemig )
17411749
17421750 def test_bdfs_implicitly_assigned_same_after_recreate (self ):
17431751 """
@@ -1784,7 +1792,7 @@ def test_bdfs_implicitly_assigned_same_after_recreate(self):
17841792 wait_for_ssh (controllerVM )
17851793
17861794 devices_after = pci_devices_by_bdf (controllerVM )
1787- assert devices_after == devices_before
1795+ self . assertEqual ( devices_after , devices_before )
17881796
17891797 def test_bdfs_dont_conflict_after_transient_unplug (self ):
17901798 """
0 commit comments