summaryrefslogtreecommitdiffstats
path: root/apex/tests/test_apex_clean.py
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2017-09-18 21:48:45 -0400
committerTim Rozet <trozet@redhat.com>2017-09-21 13:35:14 +0000
commitf9d02c076974168677bf5fdb02f26caf73924fb8 (patch)
tree9f723ded40d338f11421359acb4ac71f4a4cc167 /apex/tests/test_apex_clean.py
parent4770ea6a40807b0f80a15e406703443b9a147955 (diff)
Improves clean to cleanup virsh nets and and other bridges
Currently only the admin and external bridges will be removed from the jumphost which is only really clean for a baremetal deployment. Virtual deployments will leave br-tenant, br-api, br-storage. This patch removes those as well as deletes all Apex virsh networks from libvirt. Also checks if authorized_keys exists before trying to edit it. Change-Id: I1affe2733ba1dc38fd3b91fb14398454137f00a4 Signed-off-by: Tim Rozet <trozet@redhat.com> (cherry picked from commit 02dc854a504569da15b0e41353a9f456e02599ad)
Diffstat (limited to 'apex/tests/test_apex_clean.py')
-rw-r--r--apex/tests/test_apex_clean.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/apex/tests/test_apex_clean.py b/apex/tests/test_apex_clean.py
index b6b9d428..b3ead6f7 100644
--- a/apex/tests/test_apex_clean.py
+++ b/apex/tests/test_apex_clean.py
@@ -100,3 +100,15 @@ class TestClean:
ml.listDefinedDomains.return_value = ['undercloud']
ml.lookupByName.return_value = dummy_domain()
assert clean.clean_vms() is None
+
+ @patch('apex.network.jumphost.detach_interface_from_ovs')
+ @patch('apex.network.jumphost.remove_ovs_bridge')
+ @patch('libvirt.open')
+ def test_clean_networks(self, mock_libvirt, mock_jumphost_ovs_remove,
+ mock_jumphost_detach):
+ ml = mock_libvirt.return_value
+ ml.listNetworks.return_value = ['admin', 'external', 'tenant', 'blah']
+ mock_net = ml.networkLookupByName.return_value
+ mock_net.isActive.return_value = True
+ clean.clean_networks()
+ assert_equal(mock_net.destroy.call_count, 3)