diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-07-11 17:33:44 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-07-11 17:57:54 +0200 |
commit | 6166caffe31888ef237874fdcaf088ac4ff8d003 (patch) | |
tree | 40f78113f88ffcd4e6e4dda81e5aee9c3be95eb9 /functest/tests/unit | |
parent | 4fb7e1330137fb77ed1b29bbc7c1491b6e12d9b6 (diff) |
Clean all possible resources
It checks all openstack resources before cleaning.
It allows removing images even if the test fail quickly.
Change-Id: I1763b8a70fa7ffeb03c435e8e775c7afd1a7adac
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit')
-rw-r--r-- | functest/tests/unit/openstack/vping/test_vping_ssh.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/functest/tests/unit/openstack/vping/test_vping_ssh.py b/functest/tests/unit/openstack/vping/test_vping_ssh.py index 589668efc..3595638ec 100644 --- a/functest/tests/unit/openstack/vping/test_vping_ssh.py +++ b/functest/tests/unit/openstack/vping/test_vping_ssh.py @@ -92,6 +92,7 @@ class VpingSSHTesting(unittest.TestCase): self.vping.clean() def test_clean_exc2(self): + self.vping.vm2 = munch.Munch(id='vm2') mdelete_server = self.vping.cloud.delete_server mdelete_server.side_effect = shade.OpenStackCloudException(None) with self.assertRaises(shade.OpenStackCloudException): @@ -100,7 +101,7 @@ class VpingSSHTesting(unittest.TestCase): @mock.patch('functest.core.singlevm.SingleVm2.clean', side_effect=Exception) def test_clean_exc3(self, *args): - self.vping.vm2 = munch.Munch() + self.vping.vm2 = munch.Munch(id='vm2') with self.assertRaises(Exception): self.vping.clean() self.vping.cloud.delete_server.assert_called_once_with( @@ -109,8 +110,15 @@ class VpingSSHTesting(unittest.TestCase): args[0].assert_called_once_with() @mock.patch('functest.core.singlevm.SingleVm2.clean') - def test_clean(self, *args): - self.vping.vm2 = munch.Munch() + def test_clean1(self, *args): + self.vping.vm2 = None + self.vping.clean() + self.vping.cloud.delete_server.assert_not_called() + args[0].assert_called_once_with() + + @mock.patch('functest.core.singlevm.SingleVm2.clean') + def test_clean2(self, *args): + self.vping.vm2 = munch.Munch(id='vm2') self.vping.clean() self.vping.cloud.delete_server.assert_called_once_with( self.vping.vm2, wait=True, |