Skip to content

Commit ab14a9e

Browse files
committed
network fixture: empty_network: properly tear down it if used
unplug currently used VIF plugged in the network at teardown. network.destroy() will fail if active VIF are present. Signed-off-by: Sebastien Rodot <sebastien.rodot@vates.tech>
1 parent 9f95399 commit ab14a9e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/network/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ def vm_with_tcpdump_scope_function(vm_with_tcpdump_scope_module: VM):
5353
@pytest.fixture(scope='function')
5454
def empty_network(host: Host) -> Generator[Network, None, None]:
5555
net = host.create_network(label="empty_network for tests")
56+
5657
yield net
58+
59+
for vif_uuid in net.vif_uuids():
60+
host.xe("vif-unplug", {
61+
'uuid': vif_uuid,
62+
})
63+
5764
net.destroy()
5865

5966
@pytest.fixture(scope='function')

0 commit comments

Comments
 (0)