diff options
author | Brian Rosmaita <rosmaita.fossdev@gmail.com> | 2017-12-03 23:24:27 -0500 |
---|---|---|
committer | Brian Rosmaita <rosmaita.fossdev@gmail.com> | 2018-02-05 13:39:42 -0500 |
commit | 1eb97f877fff6e32f181366e7a72c9fd81a647ca (patch) | |
tree | 86f2b959e9e5ee9449a8188a58ce0172a7057771 | |
parent | f0cff255bbffb60138664d838c1c9c9929809aa4 (diff) | |
download | python-glanceclient-1eb97f877fff6e32f181366e7a72c9fd81a647ca.tar.gz |
Migrate dsvm functional test jobs to project repo
Zuul3-related changes in master have moved functional test gate
configuration out of infra/project-config and into the glanceclient
repository. This patch backports these changes so that the stable
branch has functional test gates.
Not a pure cherry-pick, also includes setting SWIFT_HASH, which
did not have to be done in master.
Co-authored-by: Monty Taylor <mordred@inaugust.com>
Co-authored-by: Brian Rosmaita <rosmaita.fossdev@gmail.com>
(cherry picked from commit c0e63d977fc077be55a02106403840165b89a349)
(cherry picked from commit a5985508817e5de73092a339f15ce7f9f701a20f)
Depends-On: I84de60181cb88574e341ff83cd4857cce241f2dd
Depends-On: I0fecb027e5be6f4d7bb0bf34e59a43543a421f38
Change-Id: Idaa2f4b920e131320499c9e460ade74df1d5a264
-rw-r--r-- | .zuul.yaml | 48 | ||||
-rwxr-xr-x | glanceclient/tests/functional/hooks/post_test_hook.sh | 46 | ||||
-rwxr-xr-x | tools/fix_ca_bundle.sh | 37 | ||||
-rw-r--r-- | tox.ini | 5 |
4 files changed, 90 insertions, 46 deletions
diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..0b8d434 --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,48 @@ +- job: + name: glanceclient-dsvm-functional + parent: devstack-tox-functional + description: | + devstack-based functional tests for glanceclient + required-projects: + - openstack/python-glanceclient + timeout: 4200 + vars: + devstack_localrc: + # TODO(rosmaita): remove when glanceclient tests no longer + # use the Images v1 API + GLANCE_V1_ENABLED: True + LIBS_FROM_GIT: python-glanceclient + SWIFT_HASH: de63c7a09e4049599f2d00da1a355f89 + devstack_services: + # turn off ceilometer + ceilometer-acentral: false + ceilometer-acompute: false + ceilometer-alarm-evaluator: false + ceilometer-alarm-notifier: false + ceilometer-anotification: false + ceilometer-api: false + ceilometer-collector: false + # turn on swift + s-account: true + s-container: true + s-object: true + s-proxy: true + # Hardcode glanceclient path so the job can be run on glance patches + zuul_work_dir: src/git.openstack.org/openstack/python-glanceclient + +- job: + name: glanceclient-dsvm-functional-identity-v3-only + parent: glanceclient-dsvm-functional + vars: + devstack_localrc: + ENABLE_IDENTITY_V2: False + +- project: + check: + jobs: + - glanceclient-dsvm-functional + - glanceclient-dsvm-functional-identity-v3-only: + voting: false + gate: + jobs: + - glanceclient-dsvm-functional diff --git a/glanceclient/tests/functional/hooks/post_test_hook.sh b/glanceclient/tests/functional/hooks/post_test_hook.sh deleted file mode 100755 index e0c2de0..0000000 --- a/glanceclient/tests/functional/hooks/post_test_hook.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -xe - -# 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. - -# This script is executed inside post_test_hook function in devstack gate. - -function generate_testr_results { - if [ -f .testrepository/0 ]; then - sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit - sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit - sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html - sudo gzip -9 $BASE/logs/testrepository.subunit - sudo gzip -9 $BASE/logs/testr_results.html - sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz - sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz - fi -} - -export GLANCECLIENT_DIR="$BASE/new/python-glanceclient" - -sudo chown -R jenkins:stack $GLANCECLIENT_DIR - -# Go to the glanceclient dir -cd $GLANCECLIENT_DIR - -# Run tests -echo "Running glanceclient functional test suite" -set +e -# Preserve env for OS_ credentials -sudo -E -H -u jenkins tox -efunctional -EXIT_CODE=$? -set -e - -# Collect and parse result -generate_testr_results -exit $EXIT_CODE diff --git a/tools/fix_ca_bundle.sh b/tools/fix_ca_bundle.sh new file mode 100755 index 0000000..8e3dba2 --- /dev/null +++ b/tools/fix_ca_bundle.sh @@ -0,0 +1,37 @@ +# When the functional tests are run in a devstack environment, we +# need to make sure that the python-requests module installed by +# tox in the test environment can find the distro-specific CA store +# where the devstack certs have been installed. +# +# assumptions: +# - devstack is running +# - the devstack tls-proxy service is running +# +# This code based on a function in devstack lib/tls +function set_ca_bundle { + local python_cmd='.tox/functional/bin/python' + local capath=$($python_cmd -c $'try:\n from requests import certs\n print (certs.where())\nexcept ImportError: pass') + # of course, each distro keeps the CA store in a different location + local fedora_CA='/etc/pki/tls/certs/ca-bundle.crt' + local ubuntu_CA='/etc/ssl/certs/ca-certificates.crt' + local suse_CA='/etc/ssl/ca-bundle.pem' + + # the distro CA is rooted in /etc, so if ours isn't, we need to + # change it + if [[ ! $capath == "" && ! $capath =~ ^/etc/.* && ! -L $capath ]]; then + if [[ -e $fedora_CA ]]; then + rm -f $capath + ln -s $fedora_CA $capath + elif [[ -e $ubuntu_CA ]]; then + rm -f $capath + ln -s $ubuntu_CA $capath + elif [[ -e $suse_CA ]]; then + rm -f $capath + ln -s $suse_CA $capath + else + echo "can't set CA bundle, expect tests to fail" + fi + fi +} + +set_ca_bundle @@ -30,6 +30,11 @@ warnerror = True # for information on running the functional tests. setenv = OS_TEST_PATH = ./glanceclient/tests/functional +whitelist_externals = + bash +commands = + bash tools/fix_ca_bundle.sh + python setup.py testr --testr-args='{posargs}' [testenv:cover] commands = python setup.py testr --coverage --testr-args='{posargs}' |