Do not use env var conf defaults

Falling back to environment variable credentials is convenient for
development but could lead to unexpected credentials being used during
tests. Also this is not a known practice for tempest tests.

This change removes the env var defaults and explicitly sets the
credentials to use in prepare_test_env.sh.

Pre and post grenade tests also get their config from the conf file
rather than the environment.

blueprint tempest-plugin-support

Change-Id: Icf9fb4c58ed11483106c2b62d1e1093223f7dc51
This commit is contained in:
Steve Baker 2016-08-13 09:52:41 +12:00
parent 6d8f2968ef
commit 2af6c6ffdc
6 changed files with 35 additions and 19 deletions

View File

@ -18,6 +18,7 @@ source $GRENADE_DIR/grenaderc
source $GRENADE_DIR/functions
source $TOP_DIR/openrc admin admin
source $TOP_DIR/inc/ini-config
set -o xtrace
@ -35,6 +36,14 @@ function _heat_set_user {
function create {
# run heat_integrationtests instead of tempest smoke before create
pushd $BASE_DEVSTACK_DIR/../heat
conf_file=heat_integrationtests/heat_integrationtests.conf
iniset $conf_file heat_plugin username $OS_USERNAME
iniset $conf_file heat_plugin password $OS_PASSWORD
iniset $conf_file heat_plugin tenant_name $OS_PROJECT_NAME
iniset $conf_file heat_plugin auth_url $OS_AUTH_URL
iniset $conf_file heat_plugin user_domain_name $OS_USER_DOMAIN_NAME
iniset $conf_file heat_plugin project_domain_name $OS_PROJECT_DOMAIN_NAME
iniset $conf_file heat_plugin region $OS_REGION_NAME
tox -eintegration heat_integrationtests.functional.test_create_update
popd

View File

@ -7,11 +7,16 @@ defaults match running against a recent DevStack.
To run the tests against DevStack, do the following:
# source DevStack credentials
# Define DEST
export DEST=/opt/stack
source /opt/stack/devstack/openrc
# create test resources and write config
# run the heat integration tests with those credentials
$DEST/heat/heat_integrationtests/prepare_test_env.sh
$DEST/heat/heat_integrationtests/prepare_test_network.sh
# run the heat integration tests
cd /opt/stack/heat

View File

@ -35,10 +35,8 @@ HeatGroup = [
default="orchestration",
help="Catalog type of the orchestration service."),
cfg.StrOpt('username',
default=os.environ.get('OS_USERNAME'),
help="Username to use for non admin API requests."),
cfg.StrOpt('password',
default=os.environ.get('OS_PASSWORD'),
help="Non admin API key to use when authenticating.",
secret=True),
cfg.StrOpt('admin_username',
@ -47,25 +45,19 @@ HeatGroup = [
help="Admin API key to use when authentication.",
secret=True),
cfg.StrOpt('tenant_name',
default=(os.environ.get('OS_PROJECT_NAME') or
os.environ.get('OS_TENANT_NAME')),
help="Tenant name to use for API requests."),
cfg.StrOpt('admin_tenant_name',
default='admin',
help="Admin tenant name to use for admin API requests."),
cfg.StrOpt('auth_url',
default=os.environ.get('OS_AUTH_URL'),
help="Full URI of the OpenStack Identity API (Keystone)"),
cfg.StrOpt('user_domain_name',
default=os.environ.get('OS_USER_DOMAIN_NAME'),
help="User domain name, if keystone v3 auth_url"
"is used"),
cfg.StrOpt('project_domain_name',
default=os.environ.get('OS_PROJECT_DOMAIN_NAME'),
help="Project domain name, if keystone v3 auth_url"
"is used"),
cfg.StrOpt('region',
default=os.environ.get('OS_REGION_NAME'),
help="The region name to use"),
cfg.StrOpt('instance_type',
help="Instance type for tests. Needs to be big enough for a "

View File

@ -17,8 +17,6 @@
set -ex
export DEST=${DEST:-/opt/stack/new}
source $DEST/devstack/openrc admin admin
sudo -E $DEST/heat/heat_integrationtests/prepare_test_env.sh
sudo -E $DEST/heat/heat_integrationtests/prepare_test_network.sh
source $DEST/devstack/openrc demo demo
sudo -E tox -eintegration
sudo tox -eintegration

View File

@ -16,14 +16,30 @@
# in heat_integrationtests.conf.
# Credentials are required for creating nova flavors and glance images.
set -ex
set -e
DEST=${DEST:-/opt/stack/new}
source $DEST/devstack/inc/ini-config
set -x
conf_file=$DEST/heat/heat_integrationtests/heat_integrationtests.conf
source $DEST/devstack/openrc demo demo
# user creds
iniset $conf_file heat_plugin username $OS_USERNAME
iniset $conf_file heat_plugin password $OS_PASSWORD
iniset $conf_file heat_plugin tenant_name $OS_PROJECT_NAME
iniset $conf_file heat_plugin auth_url $OS_AUTH_URL
iniset $conf_file heat_plugin user_domain_name $OS_USER_DOMAIN_NAME
iniset $conf_file heat_plugin project_domain_name $OS_PROJECT_DOMAIN_NAME
iniset $conf_file heat_plugin region $OS_REGION_NAME
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
@ -42,9 +58,6 @@ iniset $conf_file heat_plugin image_ref fedora-heat-test-image
iniset $conf_file heat_plugin boot_config_env $DEST/heat-templates/hot/software-config/boot-config/test_image_env.yaml
iniset $conf_file heat_plugin heat_config_notify_script $DEST/heat-templates/hot/software-config/elements/heat-config/bin/heat-config-notify
iniset $conf_file heat_plugin minimal_image_ref cirros-0.3.4-x86_64-uec
# admin creds already sourced, store in conf
iniset $conf_file heat_plugin admin_username $OS_USERNAME
iniset $conf_file heat_plugin admin_password $OS_PASSWORD
# Add scenario tests to skip
# VolumeBackupRestoreIntegrationTest skipped until failure rate can be reduced ref bug #1382300

View File

@ -29,7 +29,6 @@ commands =
setenv = VIRTUAL_ENV={envdir}
OS_TEST_PATH=./heat_integrationtests
TESTR_START_DIR=heat_integrationtests
passenv = OS_*
usedevelop = False
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt