summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.zuul.yaml48
-rwxr-xr-xglanceclient/tests/functional/hooks/post_test_hook.sh46
-rwxr-xr-xtools/fix_ca_bundle.sh37
-rw-r--r--tox.ini5
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
diff --git a/tox.ini b/tox.ini
index 37ce9a6..ab02ce2 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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}'