Merge "Change openstack-dev to openstack-discuss"
diff --git a/.gitreview b/.gitreview
index 9c33d46..c56730f 100644
--- a/.gitreview
+++ b/.gitreview
@@ -1,5 +1,5 @@
[gerrit]
-host=review.openstack.org
+host=review.opendev.org
port=29418
project=openstack/heat-tempest-plugin.git
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 c77bb51..9e390dc 100644
--- a/heat_tempest_plugin/config.py
+++ b/heat_tempest_plugin/config.py
@@ -12,13 +12,22 @@
from oslo_config import cfg
+import os
+
+default_template = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ 'tests/scenario/templates/boot_config_none_env.yaml')
+
service_available_group = cfg.OptGroup(name="service_available",
title="Available OpenStack Services")
ServiceAvailableGroup = [
- cfg.BoolOpt("heat_plugin",
+ cfg.BoolOpt("heat",
default=True,
- help="Whether or not heat is expected to be available"),
+ help="Whether or not heat is expected to be available",
+ deprecated_opts=[cfg.DeprecatedOpt(
+ 'heat_plugin',
+ group='service_available')]),
]
heat_group = cfg.OptGroup(name="heat_plugin",
@@ -103,8 +112,7 @@
default='public',
help="Visible floating network name "),
cfg.StrOpt('boot_config_env',
- default=('heat_tempest_plugin/tests/scenario/templates'
- '/boot_config_none_env.yaml'),
+ default=default_template,
help="Path to environment file which defines the "
"resource type Heat::InstallConfigAgent. Needs to "
"be appropriate for the image_ref."),
@@ -156,6 +164,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(
@@ -165,7 +176,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/api/gabbits/softwareconfig.yaml b/heat_tempest_plugin/tests/api/gabbits/softwareconfig.yaml
index 0d0453d..018b29c 100644
--- a/heat_tempest_plugin/tests/api/gabbits/softwareconfig.yaml
+++ b/heat_tempest_plugin/tests/api/gabbits/softwareconfig.yaml
@@ -12,6 +12,7 @@
request_headers:
content-type: application/json
data:
+ name: $ENVIRON['PREFIX']-config
group: script
config: '#!/bin/sh -x\necho hello'
status: 200
diff --git a/heat_tempest_plugin/tests/functional/test_create_update_neutron_port.py b/heat_tempest_plugin/tests/functional/test_create_update_neutron_port.py
index eeeabf3..cf51bbd 100644
--- a/heat_tempest_plugin/tests/functional/test_create_update_neutron_port.py
+++ b/heat_tempest_plugin/tests/functional/test_create_update_neutron_port.py
@@ -100,6 +100,5 @@
new_id, new_ip, new_mac = self.get_port_id_and_outputs(
stack_identifier)
# mac_address should be different
- self.assertEqual(_id, new_id)
self.assertEqual(_ip, new_ip)
self.assertNotEqual(_mac, new_mac)
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_os_wait_condition.py b/heat_tempest_plugin/tests/functional/test_os_wait_condition.py
index 603b5e5..bb8513a 100644
--- a/heat_tempest_plugin/tests/functional/test_os_wait_condition.py
+++ b/heat_tempest_plugin/tests/functional/test_os_wait_condition.py
@@ -106,5 +106,5 @@
params = {'flavor': self.conf.minimal_instance_type,
'image': self.conf.minimal_image_ref,
'network': self.conf.fixed_network_name,
- 'timeout': 120}
+ 'timeout': 180}
self.stack_create(template=self.template, parameters=params)
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/remote_nested_base.yaml b/heat_tempest_plugin/tests/scenario/templates/remote_nested_base.yaml
new file mode 100644
index 0000000..fc1441f
--- /dev/null
+++ b/heat_tempest_plugin/tests/scenario/templates/remote_nested_base.yaml
@@ -0,0 +1,29 @@
+heat_template_version: 2015-10-15
+description: |
+ The base stack (containing an actual resource) for the remote deeply-nested
+ stack test.
+
+parameters:
+ name:
+ type: string
+ description: Name of the router
+ constraints:
+ - allowed_pattern: "[a-z][a-z0-9-]{1,}"
+ network_name:
+ type: string
+ description: The network to connect to
+ constraints:
+ - custom_constraint: neutron.network
+
+resources:
+ router:
+ type: OS::Neutron::Router
+ properties:
+ name:
+ list_join: ['-', [{ get_param: name }, 'router']]
+ external_gateway_info:
+ network: {get_param: network_name}
+
+outputs:
+ router:
+ value: {get_resource: router}
diff --git a/heat_tempest_plugin/tests/scenario/templates/remote_nested_intermediate.yaml b/heat_tempest_plugin/tests/scenario/templates/remote_nested_intermediate.yaml
new file mode 100644
index 0000000..6fc7082
--- /dev/null
+++ b/heat_tempest_plugin/tests/scenario/templates/remote_nested_intermediate.yaml
@@ -0,0 +1,27 @@
+heat_template_version: 2015-10-15
+description: |
+ The intermediate stack (containing a local nested stack) to be instantiated
+ remotely in the remote deeply-nested stack test.
+
+parameters:
+ name:
+ type: string
+ description: Name of the router
+ constraints:
+ - allowed_pattern: "[a-z][a-z0-9-]{1,}"
+ network_name:
+ type: string
+ description: The public network to connect to
+ constraints:
+ - custom_constraint: neutron.network
+
+resources:
+ network_stack_as_custom_type:
+ type: remote_nested_base.yaml
+ properties:
+ name: {get_param: name}
+ network_name: {get_param: network_name}
+
+outputs:
+ router:
+ value: {get_attr: [network_stack_as_custom_type, router]}
diff --git a/heat_tempest_plugin/tests/scenario/templates/remote_nested_root.yaml b/heat_tempest_plugin/tests/scenario/templates/remote_nested_root.yaml
new file mode 100644
index 0000000..39bb8cb
--- /dev/null
+++ b/heat_tempest_plugin/tests/scenario/templates/remote_nested_root.yaml
@@ -0,0 +1,35 @@
+heat_template_version: 2015-10-15
+description: |
+ The root stack (containing a remote stack) for the deeply-nested remote
+ stack test.
+
+parameters:
+ name:
+ type: string
+ description: Name of the router
+ constraints:
+ - allowed_pattern: "[a-z][a-z0-9-]{1,}"
+ network_name:
+ type: string
+ description: The public network to connect to
+ constraints:
+ - custom_constraint: neutron.network
+ region:
+ type: string
+ description: The region in which to create the remote stack
+ default: RegionOne
+
+resources:
+ network_stack:
+ type: OS::Heat::Stack
+ properties:
+ template: {get_file: remote_nested_intermediate.yaml}
+ context:
+ region_name: {get_param: region}
+ parameters:
+ name: {get_param: name}
+ network_name: {get_param: network_name}
+
+outputs:
+ router:
+ value: {get_attr: [network_stack, outputs, router]}
diff --git a/heat_tempest_plugin/tests/scenario/templates/test_server_cfn_init.yaml b/heat_tempest_plugin/tests/scenario/templates/test_server_cfn_init.yaml
index 9f94717..ccd9bd1 100644
--- a/heat_tempest_plugin/tests/scenario/templates/test_server_cfn_init.yaml
+++ b/heat_tempest_plugin/tests/scenario/templates/test_server_cfn_init.yaml
@@ -71,8 +71,8 @@
- WaitHandle: {Ref: WaitHandle}
- |
#!/bin/bash -v
- /opt/aws/bin/cfn-init
- /opt/aws/bin/cfn-signal -e 0 --data "`cat /tmp/smoke-status`" \
+ /usr/bin/cfn-init
+ /usr/bin/cfn-signal -e 0 --data "`cat /tmp/smoke-status`" \
--id smoke_status "WaitHandle"
WaitHandle:
Type: AWS::CloudFormation::WaitConditionHandle
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_aodh_alarm.py b/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py
index 4e25158..dafca12 100644
--- a/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py
+++ b/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py
@@ -51,9 +51,9 @@
stack_identifier = self.stack_create(template=self.template,
parameters=parameters)
- measures = [{'timestamp': test.isotime(datetime.datetime.now()),
+ measures = [{'timestamp': test.isotime(datetime.datetime.utcnow()),
'value': 100}, {'timestamp': test.isotime(
- datetime.datetime.now() + datetime.timedelta(
+ datetime.datetime.utcnow() + datetime.timedelta(
minutes=1)), 'value': 100}]
# send measures(should cause the alarm to fire)
self.metric_client.metric.add_measures(metric['id'], measures)
diff --git a/heat_tempest_plugin/tests/scenario/test_remote_deeply_nested.py b/heat_tempest_plugin/tests/scenario/test_remote_deeply_nested.py
new file mode 100644
index 0000000..ef05285
--- /dev/null
+++ b/heat_tempest_plugin/tests/scenario/test_remote_deeply_nested.py
@@ -0,0 +1,39 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import six
+import uuid
+
+from heat_tempest_plugin.tests.scenario import scenario_base
+from tempest.lib import decorators
+
+
+class RemoteDeeplyNestedStackTest(scenario_base.ScenarioTestsBase):
+ @decorators.idempotent_id('2ed94cae-da14-4060-a6b3-526e7a8cbbe4')
+ def test_remote_nested(self):
+ parameters = {
+ 'name': 'remote-nested',
+ 'network_name': self.conf.floating_network_name,
+ }
+
+ stack_id = self.launch_stack(
+ template_name='remote_nested_root.yaml',
+ parameters={'region': self.conf.region},
+ environment={'parameters': parameters}
+ )
+
+ stack = self.client.stacks.get(stack_id)
+ router_id = self._stack_output(stack, 'router')
+ self.assertIsInstance(router_id, six.string_types)
+ uuid.UUID(router_id)
+
+ self._stack_delete(stack_id)
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."""
diff --git a/tox.ini b/tox.ini
index 7b8aeec..549457a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -12,6 +12,7 @@
testr run {posargs}
[testenv:pep8]
+basepython = python3
setenv =
PYTHONPATH = .
commands =
@@ -25,12 +26,14 @@
check-uuid --fix --package heat_tempest_plugin
[testenv:docs]
+basepython = python3
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
sphinxcontrib-httpdomain
commands = python setup.py build_sphinx
[testenv:venv]
+basepython = python3
commands = {posargs}
[flake8]