From 38f9687cc140e934ca15b076cdd3546c2e9dacf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mart=C3=ADn?= Date: Mon, 20 Nov 2023 16:13:58 +0100 Subject: [PATCH] Clean up libvirt network Clean up libvirt network once the script has finished successfully. --- test/cases/ostree-ami-image.sh | 4 ++++ test/cases/ostree-ignition.sh | 4 ++++ test/cases/ostree-iot-qcow2.sh | 3 +++ test/cases/ostree-ng.sh | 3 +++ test/cases/ostree-pulp.sh | 4 ++++ test/cases/ostree-raw-image.sh | 3 +++ test/cases/ostree-simplified-installer.sh | 4 ++++ test/cases/ostree-vsphere.sh | 4 ++++ test/cases/ostree.sh | 4 ++++ 9 files changed, 33 insertions(+) diff --git a/test/cases/ostree-ami-image.sh b/test/cases/ostree-ami-image.sh index a0d7b2315..93d58f1d1 100755 --- a/test/cases/ostree-ami-image.sh +++ b/test/cases/ostree-ami-image.sh @@ -204,6 +204,10 @@ wait_for_ssh_up () { clean_up () { greenprint "🧼 Cleaning up" + # Clear integration network + sudo virsh net-destroy integration + sudo virsh net-undefine integration + # Remove any status containers if exist sudo podman ps -a -q --format "{{.ID}}" | sudo xargs --no-run-if-empty podman rm -f # Remove all images diff --git a/test/cases/ostree-ignition.sh b/test/cases/ostree-ignition.sh index c25393f13..852880edb 100755 --- a/test/cases/ostree-ignition.sh +++ b/test/cases/ostree-ignition.sh @@ -225,6 +225,10 @@ wait_for_ssh_up () { clean_up () { greenprint "🧼 Cleaning up" + # Clear integration network + sudo virsh net-destroy integration + sudo virsh net-undefine integration + # Remove any status containers if exist sudo podman ps -a -q --format "{{.ID}}" | sudo xargs --no-run-if-empty podman rm -f # Remove all images diff --git a/test/cases/ostree-iot-qcow2.sh b/test/cases/ostree-iot-qcow2.sh index 8c1275969..9533a5d1d 100755 --- a/test/cases/ostree-iot-qcow2.sh +++ b/test/cases/ostree-iot-qcow2.sh @@ -205,6 +205,9 @@ clean_up () { sudo virsh undefine "${IMAGE_KEY}-uefi" --nvram # Remove qcow2 file. sudo rm -f "$LIBVIRT_IMAGE_PATH" + # Clear integration network + sudo virsh net-destroy integration + sudo virsh net-undefine integration # Remove any status containers if exist sudo podman ps -a -q --format "{{.ID}}" | sudo xargs --no-run-if-empty podman rm -f diff --git a/test/cases/ostree-ng.sh b/test/cases/ostree-ng.sh index b33fa408f..4a87bc137 100755 --- a/test/cases/ostree-ng.sh +++ b/test/cases/ostree-ng.sh @@ -331,6 +331,9 @@ clean_up () { sudo virsh undefine "${IMAGE_KEY}-uefi" --nvram # Remove qcow2 file. sudo rm -f "$LIBVIRT_UEFI_IMAGE_PATH" + # Clear integration network + sudo virsh net-destroy integration + sudo virsh net-undefine integration # Remove any status containers if exist sudo podman ps -a -q --format "{{.ID}}" | sudo xargs --no-run-if-empty podman rm -f diff --git a/test/cases/ostree-pulp.sh b/test/cases/ostree-pulp.sh index 49cea8c9f..07f80a451 100644 --- a/test/cases/ostree-pulp.sh +++ b/test/cases/ostree-pulp.sh @@ -226,6 +226,10 @@ clean_up () { fi # Remove qcow2 file. sudo rm -f "$LIBVIRT_IMAGE_PATH" + # Clear integration network + sudo virsh net-destroy integration + sudo virsh net-undefine integration + # Remomve tmp dir. sudo rm -rf "$TEMPDIR" # Stop httpd diff --git a/test/cases/ostree-raw-image.sh b/test/cases/ostree-raw-image.sh index 22b7350e1..1cae96344 100755 --- a/test/cases/ostree-raw-image.sh +++ b/test/cases/ostree-raw-image.sh @@ -254,6 +254,9 @@ clean_up () { sudo virsh undefine "${IMAGE_KEY}-uefi" --nvram # Remove qcow2 file. sudo rm -f "$LIBVIRT_IMAGE_PATH" + # Clear integration network + sudo virsh net-destroy integration + sudo virsh net-undefine integration # Remove any status containers if exist sudo podman ps -a -q --format "{{.ID}}" | sudo xargs --no-run-if-empty podman rm -f diff --git a/test/cases/ostree-simplified-installer.sh b/test/cases/ostree-simplified-installer.sh index 93175ce43..815bcffef 100755 --- a/test/cases/ostree-simplified-installer.sh +++ b/test/cases/ostree-simplified-installer.sh @@ -293,6 +293,10 @@ wait_for_fdo () { clean_up () { greenprint "🧼 Cleaning up" + # Clear integration network + sudo virsh net-destroy integration + sudo virsh net-undefine integration + # Remove any status containers if exist sudo podman ps -a -q --format "{{.ID}}" | sudo xargs --no-run-if-empty podman rm -f # Remove all images diff --git a/test/cases/ostree-vsphere.sh b/test/cases/ostree-vsphere.sh index 9630efa88..8d6f90eeb 100755 --- a/test/cases/ostree-vsphere.sh +++ b/test/cases/ostree-vsphere.sh @@ -213,6 +213,10 @@ wait_for_ssh_up () { clean_up () { greenprint "🧼 Cleaning up" + # Clear integration network + sudo virsh net-destroy integration + sudo virsh net-undefine integration + # Remove any status containers if exist sudo podman ps -a -q --format "{{.ID}}" | sudo xargs --no-run-if-empty podman rm -f # Remove all images diff --git a/test/cases/ostree.sh b/test/cases/ostree.sh index 565a72217..be7b15039 100755 --- a/test/cases/ostree.sh +++ b/test/cases/ostree.sh @@ -272,6 +272,10 @@ clean_up () { fi # Remove qcow2 file. sudo rm -f "$LIBVIRT_IMAGE_PATH" + # Clear integration network + sudo virsh net-destroy integration + sudo virsh net-undefine integration + # Remove extracted upgrade image-tar. sudo rm -rf "$UPGRADE_PATH" # Remove "remote" repo.