Merge "Increase the concurrency of software-config functional test"
diff --git a/common/test.py b/common/test.py
index 386ed59..1039625 100644
--- a/common/test.py
+++ b/common/test.py
@@ -426,7 +426,7 @@
             tags=tags
         )
         if expected_status not in ['ROLLBACK_COMPLETE'] and enable_cleanup:
-            self.addCleanup(self.client.stacks.delete, name)
+            self.addCleanup(self._stack_delete, name)
 
         stack = self.client.stacks.get(name)
         stack_identifier = '%s/%s' % (name, stack.id)
@@ -458,7 +458,7 @@
             environment=env,
             adopt_stack_data=adopt_data,
         )
-        self.addCleanup(self.client.stacks.delete, name)
+        self.addCleanup(self._stack_delete, name)
 
         stack = self.client.stacks.get(name)
         stack_identifier = '%s/%s' % (name, stack.id)
@@ -468,7 +468,7 @@
     def stack_abandon(self, stack_id):
         if (self.conf.skip_test_stack_action_list and
                 'ABANDON' in self.conf.skip_test_stack_action_list):
-            self.addCleanup(self.client.stacks.delete, stack_id)
+            self.addCleanup(self._stack_delete, stack_id)
             self.skipTest('Testing Stack abandon disabled in conf, skipping')
         info = self.client.stacks.abandon(stack_id=stack_id)
         return info
@@ -476,7 +476,7 @@
     def stack_suspend(self, stack_identifier):
         if (self.conf.skip_test_stack_action_list and
                 'SUSPEND' in self.conf.skip_test_stack_action_list):
-            self.addCleanup(self.client.stacks.delete, stack_identifier)
+            self.addCleanup(self._stack_delete, stack_identifier)
             self.skipTest('Testing Stack suspend disabled in conf, skipping')
         stack_name = stack_identifier.split('/')[0]
         self.client.actions.suspend(stack_name)
@@ -488,7 +488,7 @@
     def stack_resume(self, stack_identifier):
         if (self.conf.skip_test_stack_action_list and
                 'RESUME' in self.conf.skip_test_stack_action_list):
-            self.addCleanup(self.client.stacks.delete, stack_identifier)
+            self.addCleanup(self._stack_delete, stack_identifier)
             self.skipTest('Testing Stack resume disabled in conf, skipping')
         stack_name = stack_identifier.split('/')[0]
         self.client.actions.resume(stack_name)
diff --git a/functional/test_autoscaling.py b/functional/test_autoscaling.py
index 0beefcb..1b9fe99 100644
--- a/functional/test_autoscaling.py
+++ b/functional/test_autoscaling.py
@@ -235,7 +235,7 @@
             parameters={},
             environment=env
         )
-        self.addCleanup(self.client.stacks.delete, stack_name)
+        self.addCleanup(self._stack_delete, stack_name)
         stack = self.client.stacks.get(stack_name)
         stack_identifier = '%s/%s' % (stack_name, stack.id)
         self._wait_for_stack_status(stack_identifier, 'CREATE_FAILED')
diff --git a/functional/test_conditional_exposure.py b/functional/test_conditional_exposure.py
index 2ab297e..99e76ee 100644
--- a/functional/test_conditional_exposure.py
+++ b/functional/test_conditional_exposure.py
@@ -16,19 +16,7 @@
 from heat_integrationtests.functional import functional_base
 
 
-class ConditionalExposureTestBase(functional_base.FunctionalTestsBase):
-    def setUp(self):
-        super(ConditionalExposureTestBase, self).setUp()
-
-    def _delete(self, stack_name):
-        stacks = self.client.stacks.list()
-        for s in stacks:
-            if s.stack_name == stack_name:
-                self._stack_delete(s.identifier)
-                break
-
-
-class ServiceBasedExposureTest(ConditionalExposureTestBase):
+class ServiceBasedExposureTest(functional_base.FunctionalTestsBase):
     # NOTE(pas-ha) if we ever decide to install Sahara on Heat
     # functional gate, this must be changed to other not-installed
     # but in principle supported service
@@ -72,7 +60,6 @@
 
     def test_unavailable_resources_not_created(self):
         stack_name = self._stack_rand_name()
-        self.addCleanup(self._delete, stack_name)
         ex = self.assertRaises(exc.HTTPBadRequest,
                                self.client.stacks.create,
                                stack_name=stack_name,
diff --git a/functional/test_encrypted_parameter.py b/functional/test_encrypted_parameter.py
index e1a9b88..21dc925 100644
--- a/functional/test_encrypted_parameter.py
+++ b/functional/test_encrypted_parameter.py
@@ -16,28 +16,49 @@
 class EncryptedParametersTest(functional_base.FunctionalTestsBase):
 
     template = '''
-heat_template_version: 2013-05-23
+heat_template_version: 2014-10-16
 parameters:
+  image:
+    type: string
+  flavor:
+    type: string
+  network:
+    type: string
   foo:
     type: string
-    description: Parameter with encryption turned on
+    description: 'parameter with encryption turned on'
     hidden: true
     default: secret
+resources:
+  server_with_encrypted_property:
+    type: OS::Nova::Server
+    properties:
+      name: { get_param: foo }
+      image: { get_param: image }
+      flavor: { get_param: flavor }
+      networks: [{network: {get_param: network} }]
 outputs:
   encrypted_foo_param:
-    description: ''
-    value: {get_param: foo}
+    description: 'encrypted param'
+    value: { get_param: foo }
 '''
 
     def setUp(self):
         super(EncryptedParametersTest, self).setUp()
 
     def test_db_encryption(self):
-        # Create a stack with a non-default value for 'foo' to be encrypted
+        # Create a stack with the value of 'foo' to be encrypted
         foo_param = 'my_encrypted_foo'
+        parameters = {
+            "image": self.conf.minimal_image_ref,
+            "flavor": self.conf.minimal_instance_type,
+            'network': self.conf.fixed_network_name,
+            "foo": foo_param
+        }
+
         stack_identifier = self.stack_create(
             template=self.template,
-            parameters={'foo': foo_param}
+            parameters=parameters
         )
         stack = self.client.stacks.get(stack_identifier)
 
diff --git a/functional/test_instance_group.py b/functional/test_instance_group.py
index a8494c2..b8bcc3d 100644
--- a/functional/test_instance_group.py
+++ b/functional/test_instance_group.py
@@ -225,7 +225,7 @@
             parameters={},
             environment=env
         )
-        self.addCleanup(self.client.stacks.delete, stack_name)
+        self.addCleanup(self._stack_delete, stack_name)
         stack = self.client.stacks.get(stack_name)
         stack_identifier = '%s/%s' % (stack_name, stack.id)
         self._wait_for_stack_status(stack_identifier, 'CREATE_FAILED')
diff --git a/functional/test_notifications.py b/functional/test_notifications.py
index f24d2c2..3b8e003 100644
--- a/functional/test_notifications.py
+++ b/functional/test_notifications.py
@@ -16,8 +16,6 @@
 from oslo_messaging import transport
 import requests
 
-from testtools import testcase
-
 from heat_integrationtests.common import test
 from heat_integrationtests.functional import functional_base
 
@@ -164,7 +162,6 @@
         for n in BASIC_NOTIFICATIONS:
             self.assertIn(n, handler.notifications)
 
-    @testcase.skip('Skipped until keystone fixed #1484086')
     def test_asg_notifications(self):
         stack_identifier = self.stack_create(template=self.asg_template)
 
diff --git a/functional/test_preview.py b/functional/test_preview.py
index b4389ff..19da01b 100644
--- a/functional/test_preview.py
+++ b/functional/test_preview.py
@@ -53,9 +53,10 @@
                       'description'):
             self.assertIn(field, res)
             self.assertEqual('', res[field])
+        # 'creation_time' and 'updated_time' are None when preview
         for field in ('creation_time', 'updated_time'):
             self.assertIn(field, res)
-            self.assertIsNotNone(res[field])
+            self.assertIsNone(res[field])
         self.assertIn('output', res['attributes'])
 
         # resource_identity
diff --git a/scenario/test_ceilometer_alarm.py b/scenario/test_ceilometer_alarm.py
index e5e141b..e0523aa 100644
--- a/scenario/test_ceilometer_alarm.py
+++ b/scenario/test_ceilometer_alarm.py
@@ -11,7 +11,6 @@
 #    under the License.
 
 from oslo_log import log as logging
-from testtools import testcase
 
 from heat_integrationtests.common import test
 from heat_integrationtests.scenario import scenario_base
@@ -35,7 +34,6 @@
                                                               actual))
         return actual == expected
 
-    @testcase.skip('Skipped until keystone fixed #1484086')
     def test_alarm(self):
         """Confirm we can create an alarm and trigger it."""
 
diff --git a/scenario/test_server_cfn_init.py b/scenario/test_server_cfn_init.py
index 00a360b..267b44b 100644
--- a/scenario/test_server_cfn_init.py
+++ b/scenario/test_server_cfn_init.py
@@ -12,8 +12,6 @@
 
 import json
 
-from testtools import testcase
-
 from heat_integrationtests.common import exceptions
 from heat_integrationtests.scenario import scenario_base
 
@@ -95,7 +93,6 @@
                 self._log_console_output(servers=[server])
                 raise e
 
-    @testcase.skip('Skipped until keystone fixed #1484086')
     def test_server_cfn_init(self):
         """
         Check cfn-init and cfn-signal availability on the created server.