Split functional tests apart

Currently all the functional tests are ran together in one job. This
patch breaks the tests apart so only certain parts of them have to be ran.

This will mean the tests can be ran in parallel and only the particular
ones that are required, as the functional tests require that backend to
be avalible.

Change-Id: I61ba679b8041a89fb5a7589a62db8b6f42cd1058
This commit is contained in:
Niall Bunting 2016-06-07 14:43:50 +00:00
parent 6e7c7229ab
commit 57cea8d0dd
7 changed files with 57 additions and 36 deletions

View File

@ -0,0 +1,44 @@
# Copyright 2015 OpenStack Foundation
# All Rights Reserved.
#
# 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.
import logging
import shutil
import tempfile
from oslo_config import cfg
from glance_store.tests.functional import base
CONF = cfg.CONF
logging.basicConfig()
class TestFilesystem(base.BaseFunctionalTests):
def __init__(self, *args, **kwargs):
super(TestFilesystem, self).__init__('file', *args, **kwargs)
def setUp(self):
self.tmp_image_dir = tempfile.mkdtemp(prefix='glance_store_')
CONF.set_override('filesystem_store_datadir',
self.tmp_image_dir,
group='glance_store')
super(TestFilesystem, self).setUp()
def tearDown(self):
shutil.rmtree(self.tmp_image_dir)
super(TestFilesystem, self).tearDown()

View File

@ -14,10 +14,9 @@
# This script is executed inside gate_hook function in devstack gate.
# NOTE(NiallBunting) In future these tests should be split up. This means
# based on the store passed to this script in $1, particular services can
# be enabled.
GLANCE_STORE_DRIVER=swift
# NOTE(NiallBunting) The store to test is passed in here from the
# project config.
GLANCE_STORE_DRIVER=${1:-swift}
ENABLED_SERVICES+=",key,glance"
@ -27,10 +26,6 @@ case $GLANCE_STORE_DRIVER in
;;
esac
export DEVSTACK_LOCAL_CONFIG
export DEVSTACK_GATE_INSTALL_TESTONLY=1
export DEVSTACK_GATE_NO_SERVICES=1
export KEEP_LOCALRC=1
export GLANCE_STORE_DRIVER
export ENABLED_SERVICES

View File

@ -18,7 +18,7 @@ set -xe
export GLANCE_STORE_DIR="$BASE/new/glance_store"
SCRIPTS_DIR="/usr/os-testr-env/bin/"
venv=${1:-"dsvm-functional"}
GLANCE_STORE_DRIVER=${1:-swift}
function generate_test_logs {
local path="$1"
@ -47,10 +47,6 @@ function generate_testr_results {
sudo mv ./*.gz /opt/stack/logs/
fi
if [[ "$venv" == dsvm-functional* ]] ; then
generate_test_logs "/tmp/${venv}-logs"
fi
fi
}
@ -74,7 +70,7 @@ iniset $GLANCE_STORE_DIR/functional_testing.conf admin key $ADMIN_PASSWORD
echo "Running glance_store functional test suite"
set +e
# Preserve env for OS_ credentials
sudo -E -H -u jenkins tox -e functional
sudo -E -H -u jenkins tox -e functional-$GLANCE_STORE_DRIVER
EXIT_CODE=$?
set -e

View File

@ -16,8 +16,6 @@
import logging
import random
import shutil
import tempfile
import time
from oslo_config import cfg
@ -30,23 +28,6 @@ CONF = cfg.CONF
logging.basicConfig()
class TestFilesystem(base.BaseFunctionalTests):
def __init__(self, *args, **kwargs):
super(TestFilesystem, self).__init__('file', *args, **kwargs)
def setUp(self):
self.tmp_image_dir = tempfile.mkdtemp(prefix='glance_store_')
CONF.set_override('filesystem_store_datadir',
self.tmp_image_dir,
group='glance_store')
super(TestFilesystem, self).setUp()
def tearDown(self):
shutil.rmtree(self.tmp_image_dir)
super(TestFilesystem, self).tearDown()
class TestSwift(base.BaseFunctionalTests):
def __init__(self, *args, **kwargs):

11
tox.ini
View File

@ -39,10 +39,15 @@ commands = python setup.py testr --coverage --testr-args='^(?!.*test.*coverage).
install_command = pip install --allow-all-external --allow-insecure netaddr -U {opts} {packages}
commands = {posargs}
[testenv:functional]
[testenv:functional-swift]
sitepackages = True
setenv = OS_TEST_PATH=./glance_store/tests/functional
commands = python setup.py testr --slowest --testr-args='glance_store.tests.functional'
setenv = OS_TEST_PATH=./glance_store/tests/functional/swift
commands = python setup.py testr --slowest --testr-args='glance_store.tests.functional.swift'
[testenv:functional-filesystem]
sitepackages = True
setenv = OS_TEST_PATH=./glance_store/tests/functional/filesystem
commands = python setup.py testr --slowest --testr-args='glance_store.tests.functional.filesystem'
[flake8]
# TODO(dmllr): Analyze or fix the warnings blacklisted below