From fff6518e69d19c7946942d1bd7c68e2b76c15966 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Sat, 13 Aug 2016 09:53:07 +1200 Subject: [PATCH] Run heat_integrationtests as a tempest plugin completes blueprint tempest-plugin-support Change-Id: I0109e68bb135cd257e2fff74e75575a7e2f91539 --- devstack/upgrade/resources.sh | 1 + heat_integrationtests/README.rst | 25 ++-- heat_integrationtests/common/config.py | 28 +--- heat_integrationtests/common/test.py | 2 +- heat_integrationtests/config-generator.conf | 4 - .../heat_integrationtests.conf.sample | 136 ------------------ heat_integrationtests/plugin.py | 2 +- heat_integrationtests/post_test_hook.sh | 3 +- heat_integrationtests/prepare_test_env.sh | 8 +- tox.ini | 11 -- 10 files changed, 19 insertions(+), 201 deletions(-) delete mode 100644 heat_integrationtests/config-generator.conf delete mode 100644 heat_integrationtests/heat_integrationtests.conf.sample diff --git a/devstack/upgrade/resources.sh b/devstack/upgrade/resources.sh index f7e25d28b2..ff28ccd880 100755 --- a/devstack/upgrade/resources.sh +++ b/devstack/upgrade/resources.sh @@ -35,6 +35,7 @@ function _heat_set_user { function create { # run heat_integrationtests instead of tempest smoke before create + # TODO(sbaker) run with tempest after the next major release pushd $BASE_DEVSTACK_DIR/../heat conf_file=heat_integrationtests/heat_integrationtests.conf iniset $conf_file heat_plugin username $OS_USERNAME diff --git a/heat_integrationtests/README.rst b/heat_integrationtests/README.rst index 7087dd93e4..506ed62bf0 100644 --- a/heat_integrationtests/README.rst +++ b/heat_integrationtests/README.rst @@ -2,8 +2,8 @@ Heat integration tests ====================== -These tests can be run against any heat-enabled OpenStack cloud, however -defaults match running against a recent DevStack. +These tests can be run as a tempest plugin against any heat-enabled OpenStack +cloud, however defaults match running against a recent DevStack. To run the tests against DevStack, do the following: @@ -11,25 +11,16 @@ To run the tests against DevStack, do the following: export DEST=/opt/stack - # create test resources and write config + # create test resources and write tempest config $DEST/heat/heat_integrationtests/prepare_test_env.sh $DEST/heat/heat_integrationtests/prepare_test_network.sh - # run the heat integration tests + # run tempest selecting only these tests - cd /opt/stack/heat + cd $DEST/tempest + tempest run --regex heat_integrationtests - tox -eintegration +If custom configuration is required, edit the [heat_plugin] section of -If custom configuration is required, copy the following file: - - heat_integrationtests/heat_integrationtests.conf.sample - -to: - - heat_integrationtests/heat_integrationtests.conf - -and make any required configuration changes before running: - - tox -eintegration + $DEST/tempest/etc/tempest.conf diff --git a/heat_integrationtests/common/config.py b/heat_integrationtests/common/config.py index 80812822ab..3cef5aa33a 100644 --- a/heat_integrationtests/common/config.py +++ b/heat_integrationtests/common/config.py @@ -10,13 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -import os - from oslo_config import cfg -import heat_integrationtests - -_CONF = None +CONF = None service_available_group = cfg.OptGroup(name="service_available", title="Available OpenStack Services") @@ -155,28 +151,6 @@ HeatGroup = [ ] -def init_conf(read_conf=True): - global _CONF - if _CONF: - return _CONF - - default_config_files = None - if read_conf: - confpath = os.path.join( - os.path.dirname(os.path.realpath(heat_integrationtests.__file__)), - 'heat_integrationtests.conf') - if os.path.isfile(confpath): - default_config_files = [confpath] - - _CONF = cfg.ConfigOpts() - _CONF(args=[], project='heat_integrationtests', - default_config_files=default_config_files) - - for group, opts in list_opts(): - _CONF.register_opts(opts, group=group) - return _CONF - - def list_opts(): yield heat_group.name, HeatGroup yield service_available_group.name, ServiceAvailableGroup diff --git a/heat_integrationtests/common/test.py b/heat_integrationtests/common/test.py index 2bf77714c8..ce825c7b07 100644 --- a/heat_integrationtests/common/test.py +++ b/heat_integrationtests/common/test.py @@ -73,7 +73,7 @@ class HeatIntegrationTest(testscenarios.WithScenarios, def setUp(self): super(HeatIntegrationTest, self).setUp() - self.conf = config.init_conf().heat_plugin + self.conf = config.CONF.heat_plugin self.assertIsNotNone(self.conf.auth_url, 'No auth_url configured') diff --git a/heat_integrationtests/config-generator.conf b/heat_integrationtests/config-generator.conf deleted file mode 100644 index 4c92c48513..0000000000 --- a/heat_integrationtests/config-generator.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -output_file = heat_integrationtests/heat_integrationtests.conf.sample -wrap_width = 79 -namespace = heat_integrationtests.common.config diff --git a/heat_integrationtests/heat_integrationtests.conf.sample b/heat_integrationtests/heat_integrationtests.conf.sample deleted file mode 100644 index f7aa8607fe..0000000000 --- a/heat_integrationtests/heat_integrationtests.conf.sample +++ /dev/null @@ -1,136 +0,0 @@ -[DEFAULT] - - -[heat_plugin] - -# -# From heat_integrationtests.common.config -# - -# Catalog type of the orchestration service. (string value) -#catalog_type = orchestration - -# Username to use for non admin API requests. (string value) -#username = - -# Non admin API key to use when authenticating. (string value) -#password = - -# Username to use for admin API requests. (string value) -#admin_username = - -# Admin API key to use when authentication. (string value) -#admin_password = - -# Tenant name to use for API requests. (string value) -#tenant_name = - -# Admin tenant name to use for admin API requests. (string value) -#admin_tenant_name = admin - -# Full URI of the OpenStack Identity API (Keystone) (string value) -#auth_url = - -# User domain name, if keystone v3 auth_urlis used (string value) -#user_domain_name = - -# Project domain name, if keystone v3 auth_urlis used (string value) -#project_domain_name = - -# The region name to use (string value) -#region = - -# Instance type for tests. Needs to be big enough for a full OS plus the test -# workload (string value) -#instance_type = - -# Instance type enough for simplest cases. (string value) -#minimal_instance_type = - -# Name of image to use for tests which boot servers. (string value) -#image_ref = - -# Name of existing keypair to launch servers with. (string value) -#keypair_name = - -# Name of minimal (e.g cirros) image to use when launching test instances. -# (string value) -#minimal_image_ref = - -# Set to True if using self-signed SSL certificates. (boolean value) -#disable_ssl_certificate_validation = false - -# CA certificate to pass for servers that have https endpoint. (string value) -#ca_file = - -# Time in seconds between build status checks. (integer value) -#build_interval = 4 - -# Timeout in seconds to wait for a stack to build. (integer value) -#build_timeout = 1200 - -# Network used for SSH connections. (string value) -#network_for_ssh = heat-net - -# Visible fixed network name (string value) -#fixed_network_name = heat-net - -# Visible floating network name (string value) -#floating_network_name = public - -# Path to environment file which defines the resource type -# Heat::InstallConfigAgent. Needs to be appropriate for the image_ref. (string -# value) -#boot_config_env = heat_integrationtests/scenario/templates/boot_config_none_env.yaml - -# Visible fixed sub-network name (string value) -#fixed_subnet_name = heat-subnet - -# Timeout in seconds to wait for authentication to succeed. (integer value) -#ssh_timeout = 300 - -# IP version used for SSH connections. (integer value) -#ip_version_for_ssh = 4 - -# Timeout in seconds to wait for output from ssh channel. (integer value) -#ssh_channel_timeout = 60 - -# The mask bits for tenant ipv4 subnets (integer value) -#tenant_network_mask_bits = 28 - -# Skip all scenario tests (boolean value) -#skip_scenario_tests = false - -# Skip all functional tests (boolean value) -#skip_functional_tests = false - -# List of functional test class or class.method names to skip ex. -# AutoscalingGroupTest,InstanceGroupBasicTest.test_size_updates_work (list -# value) -#skip_functional_test_list = - -# List of scenario test class or class.method names to skip ex. -# NeutronLoadBalancerTest, AodhAlarmTest.test_alarm (list value) -#skip_scenario_test_list = - -# List of stack actions in tests to skip ex. ABANDON, ADOPT, SUSPEND, RESUME -# (list value) -#skip_test_stack_action_list = - -# Default size in GB for volumes created by volumes tests (integer value) -#volume_size = 1 - -# Timeout in seconds to wait for connectivity to server. (integer value) -#connectivity_timeout = 120 - -# Timeout in seconds to wait for adding or removing childprocess after -# receiving of sighup signal (integer value) -#sighup_timeout = 30 - -# Count of retries to edit config file during sighup. If another worker already -# edit config file, file can be busy, so need to wait and try edit file again. -# (integer value) -#sighup_config_edit_retries = 10 - -# Path to the script heat-config-notify (string value) -#heat_config_notify_script = heat-config-notify diff --git a/heat_integrationtests/plugin.py b/heat_integrationtests/plugin.py index 01d5e085c7..991b31e19b 100644 --- a/heat_integrationtests/plugin.py +++ b/heat_integrationtests/plugin.py @@ -33,7 +33,7 @@ class HeatTempestPlugin(plugins.TempestPlugin): heat_config.ServiceAvailableGroup) config.register_opt_group(conf, heat_config.heat_group, heat_config.HeatGroup) - heat_config._CONF = config.CONF + heat_config.CONF = config.CONF def get_opt_lists(self): return [(heat_config.heat_group.name, diff --git a/heat_integrationtests/post_test_hook.sh b/heat_integrationtests/post_test_hook.sh index 31752127de..e6434f725e 100755 --- a/heat_integrationtests/post_test_hook.sh +++ b/heat_integrationtests/post_test_hook.sh @@ -19,4 +19,5 @@ set -ex export DEST=${DEST:-/opt/stack/new} sudo -E $DEST/heat/heat_integrationtests/prepare_test_env.sh sudo -E $DEST/heat/heat_integrationtests/prepare_test_network.sh -sudo tox -eintegration +cd $DEST/tempest +sudo tempest run --regex heat_integrationtests diff --git a/heat_integrationtests/prepare_test_env.sh b/heat_integrationtests/prepare_test_env.sh index e323bc7440..14a008bbb8 100755 --- a/heat_integrationtests/prepare_test_env.sh +++ b/heat_integrationtests/prepare_test_env.sh @@ -13,8 +13,7 @@ # under the License. # This script creates required cloud resources and sets test options -# in heat_integrationtests.conf. -# Credentials are required for creating nova flavors and glance images. +# in tempest.conf. set -e @@ -24,7 +23,9 @@ source $DEST/devstack/inc/ini-config set -x -conf_file=$DEST/heat/heat_integrationtests/heat_integrationtests.conf +conf_file=$DEST/tempest/etc/tempest.conf + +iniset_multiline $conf_file service_available heat_plugin True source $DEST/devstack/openrc demo demo # user creds @@ -40,6 +41,7 @@ source $DEST/devstack/openrc admin admin iniset $conf_file heat_plugin admin_username $OS_USERNAME iniset $conf_file heat_plugin admin_password $OS_PASSWORD + # Register the flavors for booting test servers iniset $conf_file heat_plugin instance_type m1.heat_int iniset $conf_file heat_plugin minimal_instance_type m1.heat_micro diff --git a/tox.ini b/tox.ini index f27e2cb036..38b442bae0 100644 --- a/tox.ini +++ b/tox.ini @@ -25,16 +25,6 @@ commands = find . -type f -name "*.pyc" -delete bash tools/pretty_tox.sh '^(?!heat_integrationtests){posargs}' -[testenv:integration] -setenv = VIRTUAL_ENV={envdir} - OS_TEST_PATH=./heat_integrationtests - TESTR_START_DIR=heat_integrationtests -usedevelop = False -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt -commands = - bash tools/pretty_tox.sh '{posargs}' - [testenv:pep8] commands = flake8 heat bin/heat-api bin/heat-api-cfn bin/heat-api-cloudwatch bin/heat-engine bin/heat-manage contrib heat_integrationtests doc/source @@ -78,7 +68,6 @@ commands = [testenv:genconfig] commands = oslo-config-generator --config-file=config-generator.conf - oslo-config-generator --config-file=heat_integrationtests/config-generator.conf [testenv:bandit] deps = -r{toxinidir}/test-requirements.txt