Merge "Use cfn tools under /usr/bin instead of /opt/aws/bin"
diff --git a/heat_tempest_plugin/common/test.py b/heat_tempest_plugin/common/test.py
index ccbc12a..008ac87 100644
--- a/heat_tempest_plugin/common/test.py
+++ b/heat_tempest_plugin/common/test.py
@@ -132,19 +132,34 @@
return decorator
+def _check_require(group, feature, test_method):
+ features_group = getattr(config.CONF, group, None)
+ if not features_group:
+ return test_method
+ feature_enabled = features_group.get(feature, True)
+ skipper = testtools.skipUnless(feature_enabled,
+ "%s - Feature not enabled." % feature)
+ return skipper(test_method)
+
+
def requires_feature(feature):
'''Decorator for tests requring specific feature.
The decorated test will be skipped when a specific feature is disabled.
'''
def decorator(test_method):
- features_group = getattr(config.CONF, 'heat_features_enabled', None)
- if not features_group:
- return test_method
- feature_enabled = config.CONF.heat_features_enabled.get(feature, False)
- skipper = testtools.skipUnless(feature_enabled,
- "%s - Feature not enabled." % feature)
- return skipper(test_method)
+ return _check_require('heat_features_enabled', feature, test_method)
+ return decorator
+
+
+def requires_service_feature(service, feature):
+ '''Decorator for tests requring specific service feature enabled in tempest.
+
+ The decorated test will be skipped when a specific feature is disabled.
+ '''
+ def decorator(test_method):
+ group = service + '_feature_enabled'
+ return _check_require(group, feature, test_method)
return decorator
diff --git a/heat_tempest_plugin/config.py b/heat_tempest_plugin/config.py
index fae6ebb..c30981c 100644
--- a/heat_tempest_plugin/config.py
+++ b/heat_tempest_plugin/config.py
@@ -159,6 +159,9 @@
cfg.StrOpt('hidden_stack_tag',
default='data-processing-cluster',
help="Tag to be considered as hidden for stack tags tests"),
+ cfg.StrOpt('credential_secret_id',
+ help="Barbican secret id which storing cloud credential in "
+ "remote site."),
]
heat_features_group = cfg.OptGroup(
@@ -168,7 +171,10 @@
HeatFeaturesGroup = [
cfg.BoolOpt('stack_cancel',
default=False,
- help="If false, skip stack cancel tests")
+ help="If false, skip stack cancel tests"),
+ cfg.BoolOpt('multi_cloud',
+ default=False,
+ help="If false, skip multi-cloud tests for remote stack")
]
diff --git a/heat_tempest_plugin/tests/functional/test_external_ref.py b/heat_tempest_plugin/tests/functional/test_external_ref.py
index d6a73ac..1667908 100644
--- a/heat_tempest_plugin/tests/functional/test_external_ref.py
+++ b/heat_tempest_plugin/tests/functional/test_external_ref.py
@@ -34,25 +34,26 @@
value: {get_resource: test1}
'''
- @decorators.idempotent_id('45449bad-18ba-4148-82e6-a6bc1e9a9b04')
- def test_create_with_external_ref(self):
- stack_name = self._stack_rand_name()
- stack_identifier = self.stack_create(
- stack_name=stack_name,
- template=self.TEMPLATE_WITH_EX_REF,
+ def _stack_create(self, template):
+ self.stack_name = self._stack_rand_name()
+ self.stack_identifier = self.stack_create(
+ stack_name=self.stack_name,
+ template=template,
files={},
disable_rollback=True,
parameters={},
- environment={}
+ environment={},
+ expected_status='CREATE_COMPLETE'
)
- stack = self.client.stacks.get(stack_identifier)
-
- self._wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
expected_resources = {'test1': 'OS::Heat::TestResource'}
self.assertEqual(expected_resources,
- self.list_resources(stack_identifier))
- stack = self.client.stacks.get(stack_identifier)
+ self.list_resources(self.stack_identifier))
+
+ @decorators.idempotent_id('45449bad-18ba-4148-82e6-a6bc1e9a9b04')
+ def test_create_with_external_ref(self):
+ self._stack_create(self.TEMPLATE_WITH_EX_REF)
+ stack = self.client.stacks.get(self.stack_identifier)
self.assertEqual(
[{'description': 'No description given',
'output_key': 'str',
@@ -60,28 +61,41 @@
@decorators.idempotent_id('fb16477c-e981-4ef9-a83b-c0acc162343a')
def test_update_with_external_ref(self):
- stack_name = self._stack_rand_name()
- stack_identifier = self.stack_create(
- stack_name=stack_name,
- template=self.TEMPLATE,
- files={},
- disable_rollback=True,
- parameters={},
- environment={}
- )
- stack = self.client.stacks.get(stack_identifier)
+ self._stack_create(self.TEMPLATE)
- self._wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
- expected_resources = {'test1': 'OS::Heat::TestResource'}
- self.assertEqual(expected_resources,
- self.list_resources(stack_identifier))
- stack = self.client.stacks.get(stack_identifier)
+ stack = self.client.stacks.get(self.stack_identifier)
self.assertEqual([], stack.outputs)
- stack_name = stack_identifier.split('/')[0]
- kwargs = {'stack_id': stack_identifier, 'stack_name': stack_name,
+ stack_name = self.stack_identifier.split('/')[0]
+ kwargs = {'stack_id': self.stack_identifier, 'stack_name': stack_name,
'template': self.TEMPLATE_WITH_EX_REF, 'files': {},
'disable_rollback': True, 'parameters': {}, 'environment': {}
}
self.client.stacks.update(**kwargs)
- self._wait_for_stack_status(stack_identifier, 'UPDATE_FAILED')
+ self._wait_for_stack_status(self.stack_identifier, 'UPDATE_FAILED')
+
+ @decorators.idempotent_id('0ac301c2-b377-49b8-82e2-2458634bc8cf')
+ def test_update_stack_contain_external_ref(self):
+ self._stack_create(self.TEMPLATE_WITH_EX_REF)
+
+ stack = self.client.stacks.get(self.stack_identifier)
+ self.assertEqual(
+ [{'description': 'No description given',
+ 'output_key': 'str',
+ 'output_value': 'foobar'}], stack.outputs)
+
+ # Update Stack without change external_id
+
+ new_stack_name = self._stack_rand_name()
+ kwargs = {'stack_id': self.stack_identifier,
+ 'stack_name': new_stack_name,
+ 'template': self.TEMPLATE_WITH_EX_REF, 'files': {},
+ 'disable_rollback': True, 'parameters': {}, 'environment': {}
+ }
+ self.client.stacks.update(**kwargs)
+
+ self._wait_for_stack_status(self.stack_identifier, 'UPDATE_COMPLETE')
+
+ expected_resources = {'test1': 'OS::Heat::TestResource'}
+ self.assertEqual(expected_resources,
+ self.list_resources(self.stack_identifier))
diff --git a/heat_tempest_plugin/tests/functional/test_remote_stack.py b/heat_tempest_plugin/tests/functional/test_remote_stack.py
index 1a467f4..6c5268c 100644
--- a/heat_tempest_plugin/tests/functional/test_remote_stack.py
+++ b/heat_tempest_plugin/tests/functional/test_remote_stack.py
@@ -15,6 +15,7 @@
import six
from tempest.lib import decorators
+from heat_tempest_plugin.common import test
from heat_tempest_plugin.tests.functional import functional_base
@@ -26,6 +27,7 @@
type: OS::Heat::Stack
properties:
context:
+$MULTI_CLOUD_PROPERTIES
region_name: RegionOne
template:
get_file: remote_stack.yaml
@@ -46,6 +48,7 @@
def setUp(self):
super(RemoteStackTest, self).setUp()
+ self.template = self.template.replace('$MULTI_CLOUD_PROPERTIES', '')
# replacing the template region with the one from the config
self.template = self.template.replace('RegionOne',
self.conf.region)
@@ -83,6 +86,52 @@
remote_resources = {'random1': 'OS::Heat::RandomString'}
self.assertEqual(remote_resources, self.list_resources(remote_id))
+ def _create_with_cloud_credential(self):
+ cred_sec_id = self.conf.credential_secret_id
+ if not cred_sec_id:
+ raise self.skipException(
+ "No credential_secret_id configured to test")
+ props = """
+ credential_secret_id: %(credential_secret_id)s""" % {
+ 'credential_secret_id': cred_sec_id
+ }
+
+ self.template = self.template.replace('$MULTI_CLOUD_PROPERTIES', props)
+ files = {'remote_stack.yaml': self.remote_template}
+ stack_id = self.stack_create(files=files)
+
+ expected_resources = {'my_stack': 'OS::Heat::Stack'}
+ self.assertEqual(expected_resources, self.list_resources(stack_id))
+
+ return stack_id
+
+ @test.requires_feature('multi_cloud')
+ @decorators.idempotent_id('6b61d8e3-79df-4e84-bdcf-f734da39d52b')
+ def test_stack_create_with_cloud_credential(self):
+ """Test on create multi (OpenStack) cloud with credential
+
+ This test will use same region to simulate cross OpenStack scenario.
+ Provide credential_secret_id as input property.
+ """
+ stack_id = self._create_with_cloud_credential()
+ stack = self.client.stacks.get(stack_id)
+ output = self._stack_output(stack, 'key')
+ parent_output_value = output['remote_key']
+ self.assertEqual(32, len(parent_output_value))
+
+ rsrc = self.client.resources.get(stack_id, 'my_stack')
+ remote_id = rsrc.physical_resource_id
+ # For now we use same OpenStack environment as a simulation of remote
+ # OpenStack site.
+ rstack = self.client.stacks.get(remote_id)
+ self.assertEqual(remote_id, rstack.id)
+ remote_output_value = self._stack_output(rstack, 'remote_key')
+ self.assertEqual(32, len(remote_output_value))
+ self.assertEqual(parent_output_value, remote_output_value)
+
+ remote_resources = {'random1': 'OS::Heat::RandomString'}
+ self.assertEqual(remote_resources, self.list_resources(remote_id))
+
@decorators.idempotent_id('830bfeae-6d8a-4cb2-823d-d8b6c3a740ad')
def test_stack_create_bad_region(self):
tmpl_bad_region = self.template.replace(self.conf.region, 'DARKHOLE')
diff --git a/heat_tempest_plugin/tests/scenario/templates/test_server_software_config.yaml b/heat_tempest_plugin/tests/scenario/templates/test_server_software_config.yaml
index bf8fa9b..9df6532 100644
--- a/heat_tempest_plugin/tests/scenario/templates/test_server_software_config.yaml
+++ b/heat_tempest_plugin/tests/scenario/templates/test_server_software_config.yaml
@@ -52,7 +52,7 @@
- name: bar
outputs:
- name: result
- config: {get_file: cfg1.sh}
+ config: {get_file: /cfg1.sh}
cfg2a:
type: OS::Heat::StructuredConfig
@@ -87,7 +87,7 @@
- name: bar
outputs:
- name: result
- config: {get_file: cfg3.pp}
+ config: {get_file: /cfg3.pp}
dep1:
type: OS::Heat::SoftwareDeployment
diff --git a/heat_tempest_plugin/tests/scenario/test_server_software_config.py b/heat_tempest_plugin/tests/scenario/test_server_software_config.py
index 4d2f7dc..7da2853 100644
--- a/heat_tempest_plugin/tests/scenario/test_server_software_config.py
+++ b/heat_tempest_plugin/tests/scenario/test_server_software_config.py
@@ -27,14 +27,14 @@
CFG3_PP = '''file {'barfile':
ensure => file,
- mode => 0644,
+ mode => '0644',
path => "/tmp/$::bar",
content => "$::foo",
}
file {'output_result':
ensure => file,
path => "$::heat_outputs_path.result",
- mode => 0644,
+ mode => '0644',
content => "The file /tmp/$::bar contains $::foo for server \
$::deploy_server_id during $::deploy_action",
}
@@ -153,8 +153,8 @@
}
files = {
- 'cfg1.sh': CFG1_SH,
- 'cfg3.pp': CFG3_PP
+ 'file:///cfg1.sh': CFG1_SH,
+ 'file:///cfg3.pp': CFG3_PP
}
env_files, env = template_utils.process_environment_and_files(
diff --git a/heat_tempest_plugin/tests/scenario/test_volumes.py b/heat_tempest_plugin/tests/scenario/test_volumes.py
index 57d0936..7dfa8bf 100644
--- a/heat_tempest_plugin/tests/scenario/test_volumes.py
+++ b/heat_tempest_plugin/tests/scenario/test_volumes.py
@@ -17,11 +17,13 @@
from tempest.lib import decorators
from heat_tempest_plugin.common import exceptions
+from heat_tempest_plugin.common import test
from heat_tempest_plugin.tests.scenario import scenario_base
LOG = logging.getLogger(__name__)
+@test.requires_service_feature('volume', 'backup')
class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase):
"""Class is responsible for testing of volume backup."""