Prepare functional tests in Gate run
We need to have, in addition to unit tests, some functional tests running. Change-Id: I26ed40a5035c3129bb93319f67d8df940677afa2
This commit is contained in:
parent
828af2c700
commit
f86c9b8360
|
@ -16,6 +16,13 @@ set -eo pipefail
|
|||
|
||||
readonly PROGDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Try to detect whether we run in the OpenStack Gate.
|
||||
if [[ -d ~stack/devstack ]]; then
|
||||
export DEVSTACK_DIR=~stack/devstack
|
||||
else
|
||||
export DEVSTACK_DIR=~/devstack
|
||||
fi
|
||||
|
||||
function assert_compute {
|
||||
if [[ $(nova list | wc -l) -lt 5 ]]; then
|
||||
echo "Less than one VM, someone cleaned our VM :("
|
||||
|
@ -56,7 +63,7 @@ function assert_volume {
|
|||
########################
|
||||
### Pre check
|
||||
########################
|
||||
source ~/devstack/openrc admin admin
|
||||
source $DEVSTACK_DIR/openrc admin admin
|
||||
if [[ ! "$(openstack flavor list)" =~ 'm1.nano' ]]; then
|
||||
openstack flavor create --id 42 --ram 64 --disk 0 --vcpus 1 m1.nano
|
||||
fi
|
||||
|
@ -68,16 +75,16 @@ fi
|
|||
########################
|
||||
pid=()
|
||||
|
||||
(source ~/devstack/openrc admin admin && ${PROGDIR}/populate.sh) &
|
||||
(source $DEVSTACK_DIR/openrc admin admin && ${PROGDIR}/populate.sh) &
|
||||
pid+=($!)
|
||||
|
||||
(source ~/devstack/openrc demo demo && ${PROGDIR}/populate.sh) &
|
||||
(source $DEVSTACK_DIR/openrc demo demo && ${PROGDIR}/populate.sh) &
|
||||
pid+=($!)
|
||||
|
||||
(source ~/devstack/openrc demo invisible_to_admin && ${PROGDIR}/populate.sh) &
|
||||
(source $DEVSTACK_DIR/openrc demo invisible_to_admin && ${PROGDIR}/populate.sh) &
|
||||
pid+=($!)
|
||||
|
||||
(source ~/devstack/openrc alt_demo alt_demo && ${PROGDIR}/populate.sh) &
|
||||
(source $DEVSTACK_DIR/openrc alt_demo alt_demo && ${PROGDIR}/populate.sh) &
|
||||
pid+=($!)
|
||||
|
||||
for i in ${!pid[@]}; do
|
||||
|
@ -96,20 +103,20 @@ done
|
|||
########################
|
||||
tox -e run -- --os-cloud devstack-admin --purge-own-project --verbose # purges admin/admin
|
||||
|
||||
source ~/devstack/openrc demo demo
|
||||
source $DEVSTACK_DIR/openrc demo demo
|
||||
assert_compute && assert_network && assert_volume
|
||||
|
||||
tox -e run -- --os-cloud devstack --purge-own-project --verbose # purges demo/demo
|
||||
|
||||
source ~/devstack/openrc demo invisible_to_admin
|
||||
source $DEVSTACK_DIR/openrc demo invisible_to_admin
|
||||
assert_compute && assert_network && assert_volume
|
||||
|
||||
tox -e run -- --os-auth-url http://localhost/identity_admin --os-username demo --os-project-name invisible_to_admin --os-password testtest --purge-own-project --verbose
|
||||
|
||||
source ~/devstack/openrc alt_demo alt_demo
|
||||
source $DEVSTACK_DIR/openrc alt_demo alt_demo
|
||||
assert_compute && assert_network && assert_volume
|
||||
|
||||
source ~/devstack/openrc admin admin
|
||||
source $DEVSTACK_DIR/openrc admin admin
|
||||
openstack project set --disable alt_demo
|
||||
tox -e run -- --os-auth-url http://localhost/identity_admin --os-username admin --os-project-name admin --os-password testtest --purge-project alt_demo --verbose
|
||||
openstack project set --enable alt_demo
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 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.
|
||||
|
||||
export OSPURGE_DIR="$BASE/new/ospurge"
|
||||
|
||||
cd $OSPURGE_DIR
|
||||
sudo chown -R jenkins:stack $OSPURGE_DIR
|
||||
|
||||
CLOUDS_YAML=/etc/openstack/clouds.yaml
|
||||
|
||||
if [ ! -e ${CLOUDS_YAML} ]; then
|
||||
# stable/liberty had clouds.yaml in the home/base directory
|
||||
sudo mkdir -p /etc/openstack
|
||||
sudo cp $BASE/new/.config/openstack/clouds.yaml ${CLOUDS_YAML}
|
||||
sudo chown -R jenkins:stack /etc/openstack
|
||||
fi
|
||||
|
||||
|
||||
echo "Running OSpurge functional test suite"
|
||||
set +e
|
||||
sudo -E -H -u jenkins tox -e functional
|
||||
EXIT_CODE=$?
|
||||
set -e
|
||||
|
||||
exit $EXIT_CODE
|
||||
|
8
tox.ini
8
tox.ini
|
@ -4,11 +4,12 @@ minversion = 1.9
|
|||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
usedevelop=True
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
basepython =
|
||||
run,pep8,cover,mypy,pip-check-reqs,py35: python3.5
|
||||
run,pep8,cover,mypy,pip-check-reqs,py35,functional: python3.5
|
||||
docs,venv: python2
|
||||
commands =
|
||||
python setup.py testr --testr-args='{posargs}'
|
||||
|
@ -17,7 +18,6 @@ commands =
|
|||
commands = {posargs}
|
||||
|
||||
[testenv:run]
|
||||
usedevelop=True
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
commands =
|
||||
|
@ -68,6 +68,10 @@ commands =
|
|||
python setup.py build_sphinx -E
|
||||
echo "Documentation location: {toxinidir}/doc/build/html/index.html"
|
||||
|
||||
[testenv:functional]
|
||||
commands =
|
||||
{toxinidir}/tools/func-tests.sh
|
||||
|
||||
[flake8]
|
||||
ignore = H404,H405
|
||||
enable-extensions = H106,H203,H904
|
||||
|
|
Loading…
Reference in New Issue