]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Make sure the functional test always cleans up
authorTomas Sedovic <tomas@sedovic.cz>
Thu, 30 Aug 2012 13:44:41 +0000 (15:44 +0200)
committerTomas Sedovic <tomas@sedovic.cz>
Thu, 30 Aug 2012 13:44:41 +0000 (15:44 +0200)
Change-Id: I740f676452905d3aceb3d2df37e4c4cdb6b81d7e
Signed-off-by: Tomas Sedovic <tomas@sedovic.cz>
heat/tests/functional/test_WordPress_Single_Instance.py

index c14d99a4740ea59d60e3ead2a53eac459a269647..486239615b0a97af0533334002563d0ec0a575c4 100644 (file)
@@ -20,24 +20,24 @@ from nose.plugins.attrib import attr
 @attr(speed='slow')
 @attr(tag=['func', 'wordpress'])
 def test_template():
-
-    template = 'WordPress_Single_Instance.template'
-
-    func_utils = util.FuncUtils()
-
-    func_utils.prepare_jeos('F17', 'x86_64', 'cfntools')
-    func_utils.create_stack(template, 'F17')
-    func_utils.check_cfntools()
-    func_utils.wait_for_provisioning()
-    func_utils.check_user_data(template)
-
-    ssh = func_utils.get_ssh_client()
-
-    # ensure wordpress was installed
-    wp_file = '/etc/wordpress/wp-config.php'
-    stdin, stdout, sterr = ssh.exec_command('ls ' + wp_file)
-    result = stdout.readlines().pop().rstrip()
-    assert result == wp_file
-    print "Wordpress installation detected"
-
-    func_utils.cleanup()
+    try:
+        template = 'WordPress_Single_Instance.template'
+
+        func_utils = util.FuncUtils()
+
+        func_utils.prepare_jeos('F17', 'x86_64', 'cfntools')
+        func_utils.create_stack(template, 'F17')
+        func_utils.check_cfntools()
+        func_utils.wait_for_provisioning()
+        func_utils.check_user_data(template)
+
+        ssh = func_utils.get_ssh_client()
+
+        # ensure wordpress was installed
+        wp_file = '/etc/wordpress/wp-config.php'
+        stdin, stdout, sterr = ssh.exec_command('ls ' + wp_file)
+        result = stdout.readlines().pop().rstrip()
+        assert result == wp_file
+        print "Wordpress installation detected"
+    finally:
+        func_utils.cleanup()