Add .gitreview file, do not run integ tests by default
Change-Id: I418de2e0587114f9181fdda8f17518b2c43557a4
This commit is contained in:
4
.gitreview
Normal file
4
.gitreview
Normal file
@@ -0,0 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=stackforge/gnocchi.git
|
||||
@@ -17,6 +17,7 @@
|
||||
# under the License.
|
||||
import datetime
|
||||
import functools
|
||||
import json
|
||||
import uuid
|
||||
|
||||
import iso8601
|
||||
@@ -26,13 +27,12 @@ import six
|
||||
import voluptuous
|
||||
|
||||
from gnocchi import indexer
|
||||
from gnocchi.openstack.common import jsonutils
|
||||
from gnocchi.openstack.common import timeutils
|
||||
from gnocchi import storage
|
||||
|
||||
|
||||
def deserialize(schema):
|
||||
params = jsonutils.loads(pecan.request.body)
|
||||
params = json.loads(pecan.request.body)
|
||||
try:
|
||||
return schema(params)
|
||||
except voluptuous.Error as e:
|
||||
|
||||
@@ -63,10 +63,9 @@ def _get_driver(name, conf):
|
||||
:param name: The name of the driver.
|
||||
:param conf: The conf to pass to the driver.
|
||||
"""
|
||||
return driver.DriverManager('gnocchi.storage',
|
||||
name,
|
||||
invoke_args=(conf,),
|
||||
invoke_on_load=True).driver
|
||||
d = driver.DriverManager('gnocchi.storage',
|
||||
name).driver
|
||||
return d(conf)
|
||||
|
||||
|
||||
def get_driver(conf):
|
||||
|
||||
@@ -104,10 +104,11 @@ class SwiftStorage(storage.StorageDriver):
|
||||
for second, size in archive
|
||||
])
|
||||
compressed = six.StringIO()
|
||||
with gzip.GzipFile(
|
||||
fileobj=compressed, mode="wb",
|
||||
compresslevel=self.compresslevel) as z:
|
||||
z.write(tsc.serialize())
|
||||
z = gzip.GzipFile(
|
||||
fileobj=compressed, mode="wb",
|
||||
compresslevel=self.compresslevel)
|
||||
z.write(tsc.serialize())
|
||||
z.close()
|
||||
self.swift.put_object(entity, aggregation,
|
||||
compressed.getvalue())
|
||||
|
||||
@@ -146,9 +147,10 @@ class SwiftStorage(storage.StorageDriver):
|
||||
for measure in measures:
|
||||
tsc[measure.timestamp] = measure.value
|
||||
compressed = six.StringIO()
|
||||
with gzip.GzipFile(fileobj=compressed, mode="wb",
|
||||
compresslevel=self.compresslevel) as z:
|
||||
z.write(tsc.serialize())
|
||||
z = gzip.GzipFile(fileobj=compressed, mode="wb",
|
||||
compresslevel=self.compresslevel)
|
||||
z.write(tsc.serialize())
|
||||
z.close()
|
||||
self.swift.put_object(entity, aggregation,
|
||||
compressed.getvalue())
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@ def _skip_decorator(func):
|
||||
return func(*args, **kwargs)
|
||||
except AssertionError:
|
||||
raise
|
||||
# FIXME(jd) Some Python code that is not our own can raise this, and
|
||||
# therefore skip a test without us knowing, which is a bad idea. We
|
||||
# need to define our own NotImplementedError.
|
||||
except NotImplementedError as e:
|
||||
raise testcase.TestSkipped(six.text_type(e))
|
||||
return skip_if_not_implemented
|
||||
@@ -120,6 +123,9 @@ class TestCase(testtools.TestCase, testscenarios.TestWithScenarios):
|
||||
self.conf.set_override('connection',
|
||||
getattr(self, "db_url", "sqlite:///"),
|
||||
'database')
|
||||
# No env var exported, no integration tests
|
||||
if self.conf.database.connection is None:
|
||||
raise NotImplementedError
|
||||
self.index = indexer.get_driver(self.conf)
|
||||
try:
|
||||
self.index.upgrade()
|
||||
|
||||
28
run-integration-tests.sh
Executable file
28
run-integration-tests.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash -x
|
||||
memcached &
|
||||
|
||||
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" >/dev/null &
|
||||
}
|
||||
|
||||
# Start PostgreSQL process for tests
|
||||
PGSQL_DATA=`mktemp -d /tmp/gnocchi-psql-XXXXX`
|
||||
PGSQL_PATH=`pg_config --bindir`
|
||||
${PGSQL_PATH}/initdb ${PGSQL_DATA}
|
||||
mkfifo ${PGSQL_DATA}/out
|
||||
${PGSQL_PATH}/postgres -F -k ${PGSQL_DATA} -D ${PGSQL_DATA} -p 9823 &> ${PGSQL_DATA}/out &
|
||||
# Wait for PostgreSQL to start listening to connections
|
||||
wait_for_line "database system is ready to accept connections" ${PGSQL_DATA}/out
|
||||
export GNOCCHI_TEST_PGSQL_URL="postgresql:///?host=${PGSQL_DATA}&port=9823&dbname=template1"
|
||||
|
||||
python setup.py testr --slowest --testr-args="$*"
|
||||
|
||||
ret=$?
|
||||
kill $(jobs -p)
|
||||
rm -rf "${PGSQL_DATA}"
|
||||
exit $ret
|
||||
20
run-tests.sh
20
run-tests.sh
@@ -1,28 +1,8 @@
|
||||
#!/bin/bash -x
|
||||
memcached &
|
||||
|
||||
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" >/dev/null &
|
||||
}
|
||||
|
||||
# Start PostgreSQL process for tests
|
||||
PGSQL_DATA=`mktemp -d /tmp/gnocchi-psql-XXXXX`
|
||||
PGSQL_PATH=`pg_config --bindir`
|
||||
${PGSQL_PATH}/initdb ${PGSQL_DATA}
|
||||
mkfifo ${PGSQL_DATA}/out
|
||||
${PGSQL_PATH}/postgres -F -k ${PGSQL_DATA} -D ${PGSQL_DATA} -p 9823 &> ${PGSQL_DATA}/out &
|
||||
# Wait for PostgreSQL to start listening to connections
|
||||
wait_for_line "database system is ready to accept connections" ${PGSQL_DATA}/out
|
||||
export GNOCCHI_TEST_PGSQL_URL="postgresql:///?host=${PGSQL_DATA}&port=9823&dbname=template1"
|
||||
|
||||
python setup.py testr --slowest --testr-args="$*"
|
||||
|
||||
ret=$?
|
||||
kill $(jobs -p)
|
||||
rm -rf "${PGSQL_DATA}"
|
||||
exit $ret
|
||||
|
||||
6
tox.ini
6
tox.ini
@@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = py27,py33,pypy,pep8
|
||||
envlist = py27-integ,py27,py33,pypy,pep8
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
@@ -15,6 +15,10 @@ deps = -r{toxinidir}/requirements.txt
|
||||
hacking<0.9
|
||||
commands = flake8
|
||||
|
||||
[testenv:py27-integ]
|
||||
baseversion = 2.7
|
||||
commands = {toxinidir}/run-integration-tests.sh {posargs}
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user