deckhand/tools/functional-tests.sh
Sergiy Markin ac4edb0c64 [focal] Deckhand project updates
- adjusted .gitignore to keep fresh egg-info and omit build artifacts
- fresh egg-info data is needed for promenade that depends on Deckhand
- restored deckhand-functional-uwsgi-py38 gate
- restored deckhand-integration-uwsgi-py38 gate
- made deckhand-airskiff-deployment gate voting ( treasuremap project
  has been updated)
- removed bionic gates
- updated focal dockerfile
- added more binary deps into bindep.txt
- updated deckhand chart values to latest images - focal and wallaby
- fixed python code to compy with CVE's found by fresh version of bandit
- implemented pip freeze approach
- added tox -e freeze profile to manage it
- requirements-frozen.txt is now main file with requirements
- requirements-direct.txt is the file to control deps
- updated setup.cfg to adjust to newer version of setuptools
- fixed airskiff-deploy gate
- fixed docker-image-build playbook to restore Quay repo image publish
- updated other playbooks to include roles from zuul/base-jobs in order
  to setup build hosts properly
- removed workaround with hardcoded dns resolver ip 10.96.0.10 as it
  became obsolette due to recent fix in openstack-helm-infra
- adjusted tools/whitespace-linter.sh script
- tox.ini has been brought to compliance with tox4 requirements
- replaced str() calls with six.text_type() according to D325 Deckhand specific
  commandment from Hacking.rst
- locked python-barbicanclient version with 5.2.0 because of breaking
  changes in the upper versions

Change-Id: I1cd3c97e83569c4db7e958b3400bdd4b7ea5e668
2023-04-20 19:39:43 +00:00

74 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Script intended for running Deckhand functional tests via gabbi for
# developers. Dependencies include gabbi, pifpaf and uwsgi.
#
# Usage: pifpaf run postgresql -- tools/functional-tests.sh
set -xe
CURRENT_DIR="$(pwd)"
function cleanup_deckhand {
set +e
# Kill PostgreSQL if it is still running.
# pifpaf_stop || deactive
# Kill uwsgi service if it is still running.
PID=$( sudo netstat -tulpn | grep ":9000" | head -n 1 | awk '{print $NF}' )
if [ -n $PID ]; then
PID=${PID%/*}
sudo kill -9 $PID
fi
}
trap cleanup_deckhand EXIT
function deploy_deckhand {
gen_config true "127.0.0.1:9000"
gen_paste true
log_section "Running Deckhand via uwsgi."
source ${CURRENT_DIR}/entrypoint.sh alembic upgrade head &
# Give time for migrations to complete.
sleep 10
source ${CURRENT_DIR}/entrypoint.sh server &
# Give the server a chance to come up. Better to poll a health check.
sleep 10
}
export AIRSHIP_DECKHAND_DATABASE_URL=${PIFPAF_POSTGRESQL_URL}
# Deploy Deckhand and PostgreSQL and run tests.
source ${CURRENT_DIR}/tools/common-tests.sh
deploy_deckhand
log_section "Running tests."
export DECKHAND_TEST_DIR=${CURRENT_DIR}/deckhand/tests/functional/gabbits
set +e
posargs=$@
if [ ${#posargs} -ge 1 ]; then
stestr --test-path deckhand/tests/common/ run --serial --slowest --force-subunit-trace --color $1
else
stestr --test-path deckhand/tests/common/ run --serial --slowest --force-subunit-trace --color
fi
TEST_STATUS=$?
set -e
if [ "x$TEST_STATUS" = "x0" ]; then
log_section Done SUCCESS
else
log_section Deckhand Server Log
log_section Done FAILURE
exit ${TEST_STATUS}
fi