From c02879185244ba6ccb8a8e9c1212b24302819231 Mon Sep 17 00:00:00 2001 From: Mike Fedosin Date: Fri, 28 Jul 2017 23:04:13 +0300 Subject: [PATCH] Enable tempest tests for Glare Change-Id: Ia4d8014b04c5a39b59f6af8f87e9195cd93e5e80 --- glare_tempest_plugin/contrib/gate_hook.sh | 12 +++ .../contrib/post_test_hook.sh | 19 +++++ glare_tempest_plugin/contrib/pre_test_hook.sh | 1 + glare_tempest_plugin/contrib/tempest.conf | 81 +++++++++++++++++++ glare_tempest_plugin/tests/api/base.py | 5 +- 5 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 glare_tempest_plugin/contrib/tempest.conf diff --git a/glare_tempest_plugin/contrib/gate_hook.sh b/glare_tempest_plugin/contrib/gate_hook.sh index 8e40c3e..611090c 100644 --- a/glare_tempest_plugin/contrib/gate_hook.sh +++ b/glare_tempest_plugin/contrib/gate_hook.sh @@ -12,3 +12,15 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + +export DEVSTACK_GATE_INSTALL_TESTONLY=1 +export DEVSTACK_GATE_TEMPEST=1 +export DEVSTACK_GATE_TEMPEST_NOTESTS=1 +export KEEP_LOCALRC=1 + +export DEVSTACK_LOCAL_CONFIG+=$'\n'"GLARE_CUSTOM_MODULES=glare.tests.sample_artifact" +export DEVSTACK_LOCAL_CONFIG+=$'\n'"GLARE_ENABLED_TYPES=heat_templates,heat_environments,murano_packages,tosca_templates,images,sample_artifact" + +GATE_DEST=$BASE/new +DEVSTACK_PATH=$GATE_DEST/devstack +$GATE_DEST/devstack-gate/devstack-vm-gate.sh diff --git a/glare_tempest_plugin/contrib/post_test_hook.sh b/glare_tempest_plugin/contrib/post_test_hook.sh index 8e40c3e..72ecac0 100644 --- a/glare_tempest_plugin/contrib/post_test_hook.sh +++ b/glare_tempest_plugin/contrib/post_test_hook.sh @@ -12,3 +12,22 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + +sudo chmod -R a+rw /opt/stack/ +DEVSTACK_PATH="$BASE/new" +(cd $DEVSTACK_PATH/glare/; sudo virtualenv .venv) +. $DEVSTACK_PATH/glare/.venv/bin/activate + +(cd $DEVSTACK_PATH/tempest/; sudo pip install -r requirements.txt -r test-requirements.txt) + +(cd $DEVSTACK_PATH/; sudo sh -c 'cp -rf glare/glare_tempest_plugin/contrib/tempest.conf /etc/tempest.conf') + +sudo cp $DEVSTACK_PATH/tempest/etc/logging.conf.sample $DEVSTACK_PATH/tempest/etc/logging.conf + +(cd $DEVSTACK_PATH/glare/; sudo pip install -r requirements.txt -r test-requirements.txt) +(cd $DEVSTACK_PATH/glare/; sudo python setup.py install) + +(cd $DEVSTACK_PATH/tempest/; sudo rm -rf .testrepository) +(cd $DEVSTACK_PATH/tempest/; sudo testr init) +echo "running glare tests" +(cd $BASE/new/tempest/; sudo -E tox -eall-plugin glare) diff --git a/glare_tempest_plugin/contrib/pre_test_hook.sh b/glare_tempest_plugin/contrib/pre_test_hook.sh index 8e40c3e..697063b 100644 --- a/glare_tempest_plugin/contrib/pre_test_hook.sh +++ b/glare_tempest_plugin/contrib/pre_test_hook.sh @@ -12,3 +12,4 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + diff --git a/glare_tempest_plugin/contrib/tempest.conf b/glare_tempest_plugin/contrib/tempest.conf new file mode 100644 index 0000000..b59d96c --- /dev/null +++ b/glare_tempest_plugin/contrib/tempest.conf @@ -0,0 +1,81 @@ +# Copyright 2016 - Nokia +# +# 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. + +[identity] + +# Username to use for Nova API requests. (string value) +# This option is deprecated for removal. +# Its value may be silently ignored in the future. +username = admin + +# Project name to use for Nova API requests. (string value) +# Deprecated group/name - [DEFAULT]/tenant_name +# This option is deprecated for removal. +# Its value may be silently ignored in the future. +project_name = admin + +# Role required to administrate keystone. (string value) +admin_role = admin + +# API key to use when authenticating. (string value) +# This option is deprecated for removal. +# Its value may be silently ignored in the future. +password = secretadmin + + +# The identity region name to use. Also used as the other services' +# region name unless they are set explicitly. If no such region is +# found in the service catalog, the first found one is used. (string +# value) +region = RegionOne + +# Identity API version to be used for authentication for API tests. +# (string value) +auth_version = v2 + +# Full URI of the OpenStack Identity API (Keystone), v2 (string value) +uri = http://127.0.0.1:5000/v2.0/ + +# Full URI of the OpenStack Identity API (Keystone), v3 (string value) +uri_v3 = http://127.0.0.1:35357/v3/ + +[auth] + +# Allows test cases to create/destroy projects and users. This option +# requires that OpenStack Identity API admin credentials are known. If +# false, isolated test cases and parallel execution, can still be +# achieved configuring a list of test accounts (boolean value) +# Deprecated group/name - [auth]/allow_tenant_isolation +# Deprecated group/name - [compute]/allow_tenant_isolation +# Deprecated group/name - [orchestration]/allow_tenant_isolation +use_dynamic_credentials = true + +# Username for an administrative user. This is needed for +# authenticating requests made by project isolation to create users +# and projects (string value) +# Deprecated group/name - [identity]/admin_username +admin_username = admin + +# Project name to use for an administrative user. This is needed for +# authenticating requests made by project isolation to create users +# and projects (string value) +# Deprecated group/name - [auth]/admin_tenant_name +# Deprecated group/name - [identity]/admin_tenant_name +admin_project_name = admin + +# Password to use for an administrative user. This is needed for +# authenticating requests made by project isolation to create users +# and projects (string value) +# Deprecated group/name - [identity]/admin_password +admin_password = secretadmin \ No newline at end of file diff --git a/glare_tempest_plugin/tests/api/base.py b/glare_tempest_plugin/tests/api/base.py index f6123b3..7936167 100644 --- a/glare_tempest_plugin/tests/api/base.py +++ b/glare_tempest_plugin/tests/api/base.py @@ -16,9 +16,9 @@ from glare_tempest_plugin import clients from tempest.common import credentials_factory as common_creds -from tempest.common import dynamic_creds from tempest import config from tempest.lib import base +from tempest.lib.common import dynamic_creds CONF = config.CONF @@ -61,10 +61,13 @@ class BaseArtifactTest(base.BaseTestCase): identity_version = CONF.identity.auth_version if identity_version == 'v3': cls.admin_role = CONF.identity.admin_role + cls.identity_uri = CONF.identity.uri_v3 else: cls.admin_role = 'admin' + cls.identity_uri = CONF.identity.uri cls.dynamic_cred = dynamic_creds.DynamicCredentialProvider( identity_version=CONF.identity.auth_version, + identity_uri=cls.identity_uri, name=cls.__name__, admin_role=cls.admin_role, admin_creds=common_creds.get_configured_admin_credentials( 'identity_admin'))