Merge "Use overtest to run Gnocchi"

This commit is contained in:
Jenkins 2016-03-08 09:07:31 +00:00 committed by Gerrit Code Review
commit 2f91cd1a17
3 changed files with 6 additions and 51 deletions

View File

@ -29,7 +29,7 @@ class GnocchiClient(object):
def __init__(self):
self.cli_dir = os.environ.get('GNOCCHI_CLIENT_EXEC_DIR')
self.endpoint = os.environ.get('GNOCCHI_ENDPOINT')
self.endpoint = os.environ.get('OVERTEST_GNOCCHI_HTTP_URL')
self.user_id = str(uuid.uuid4())
self.project_id = str(uuid.uuid4())

View File

@ -1,46 +0,0 @@
#!/bin/bash
set -e -x
wait_for_line () {
while read line
do
echo "$line" | grep -q "$1" && break
done < "$2"
# Read the fifo for ever otherwise process would block
cat "$2" &
}
clean_exit () {
local error_code="$?"
kill $(jobs -p)
rm -rf "$@"
return $error_code
}
GNOCCHI_DATA=`mktemp -d /tmp/gnocchi-data-XXXXX`
trap "clean_exit \"$GNOCCHI_DATA\"" EXIT
source $(which overtest) mysql
mkfifo ${GNOCCHI_DATA}/out
cat > ${GNOCCHI_DATA}/gnocchi.conf <<EOF
[oslo_policy]
policy_file = ${VIRTUAL_ENV}/etc/gnocchi/policy.json
[api]
paste_config = ${VIRTUAL_ENV}/etc/gnocchi/api-paste.ini
[storage]
metric_processing_delay = 1
file_basepath = ${GNOCCHI_DATA}
driver = file
coordination_url = file://${GNOCCHI_DATA}
[indexer]
url = ${OVERTEST_URL/#mysql:/mysql+pymysql:}
EOF
gnocchi-upgrade --config-file ${GNOCCHI_DATA}/gnocchi.conf
gnocchi-metricd --config-file ${GNOCCHI_DATA}/gnocchi.conf &>/dev/null &
gnocchi-api --config-file ${GNOCCHI_DATA}/gnocchi.conf &> ${GNOCCHI_DATA}/out &
# Wait for Gnocchi to start
wait_for_line "Running on http://0.0.0.0:8041/" ${GNOCCHI_DATA}/out
export GNOCCHI_ENDPOINT=http://localhost:8041/
$*

View File

@ -8,11 +8,12 @@ usedevelop = True
setenv =
VIRTUAL_ENV={envdir}
GNOCCHI_CLIENT_EXEC_DIR={envdir}/bin
OVERTEST_DEBUG=1
passenv = GNOCCHI_* OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE
deps = .[test]
http://tarballs.openstack.org/gnocchi/gnocchi-master.tar.gz#egg=gnocchi[mysql,file]
overtest
commands = {toxinidir}/setup-tests.sh python setup.py test --slowest --testr-args='{posargs}'
http://tarballs.openstack.org/gnocchi/gnocchi-master.tar.gz#egg=gnocchi[postgresql,file]
overtest>=0.12
commands = overtest gnocchi python setup.py test --slowest --testr-args='{posargs}'
[testenv:pep8]
deps = hacking<0.11,>=0.10.0
@ -38,7 +39,7 @@ setenv = SPHINX_HTML_THEME=sphinx_rtd_theme
commands = python setup.py build_sphinx
[testenv:debug]
commands = {toxinidir}/setup-tests.sh oslo_debug_helper {posargs}
commands = overtest gnocchi oslo_debug_helper {posargs}
[flake8]
show-source = True