Enable amqp's protocol unit tests everywhere

Now that python-qpid-proton has taken an approach similar to zmq's, it's
possible to install it in boxes where the C libraries are not present in
the system. This patch takes advantage of that to enable amqp protocol's
tests everywhere.

Change-Id: Ibce4c791aafadf45fa876d6a4f5373fde94769ff
This commit is contained in:
Flavio Percoco 2015-05-29 10:14:19 +02:00
parent 3800dd61c5
commit f06b19628f
4 changed files with 24 additions and 28 deletions

View File

@ -1,9 +1,3 @@
# TODO(kgiusti) AMQP 1.0 support depends on the Qpid Proton AMQP 1.0 # AMQP 1.0 support depends on the Qpid Proton AMQP 1.0
# development libraries. As these are not yet available from the # development libraries.
# Ubuntu repositories, do not require these packages by default. If pyngus>=1.3.1 # Apache-2.0
# you have installed the Proton development libraries, you can run the
# amqp1 driver tox tests this way:
# tox -e amqp1
pyngus>=1.0.0,<2.0.0 # Apache-2.0
python-qpid-proton>=0.7,<0.9 # Apache-2.0

View File

@ -33,6 +33,13 @@ sudo chown -R jenkins:stack $BASE/new/oslo.messaging
set +e set +e
if [ -x "$(command -v yum)" ]; then
sudo yum install -y libuuid-devel swig pkg-config
else
sudo apt-get update -y
sudo apt-get install -y uuid-dev swig pkg-config
fi
# Install required packages # Install required packages
case $RPC_BACKEND in case $RPC_BACKEND in
zeromq) zeromq)
@ -44,9 +51,7 @@ case $RPC_BACKEND in
sudo apt-get install -y qpidd sasl2-bin sudo apt-get install -y qpidd sasl2-bin
;; ;;
amqp1) amqp1)
# qpid-tools is needed to ensure authentification works before sudo yum install -y qpid-cpp-server qpid-proton-c-devel python-qpid-proton cyrus-sasl-lib cyrus-sasl-plain
# starting tests, otherwise tests will retries forever
sudo yum install -y qpid-cpp-server qpid-proton-c-devel python-qpid-proton cyrus-sasl-lib cyrus-sasl-plain
;; ;;
rabbit) rabbit)
sudo apt-get update -y sudo apt-get update -y

View File

@ -20,19 +20,18 @@ import threading
import time import time
import uuid import uuid
import six
from six import moves from six import moves
import testtools import testtools
from oslo import messaging from oslo import messaging
from oslo.utils import importutils
from oslo_messaging.tests import utils as test_utils from oslo_messaging.tests import utils as test_utils
# TODO(kgiusti) Conditionally run these tests only if the necessary if six.PY2:
# dependencies are installed. This should be removed once the proton libraries # NOTE(flaper87): pyngus currently doesn't support py34. It's
# are available in the base repos for all supported platforms. # on the works, though.
pyngus = importutils.try_import("pyngus")
if pyngus:
from oslo_messaging._drivers.protocols.amqp import driver as amqp_driver from oslo_messaging._drivers.protocols.amqp import driver as amqp_driver
import pyngus
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -71,7 +70,7 @@ class _ListenerThread(threading.Thread):
return msgs return msgs
@testtools.skipUnless(pyngus, "proton modules not present") @testtools.skipUnless(six.PY2, "No Py3K support yet")
class TestProtonDriverLoad(test_utils.BaseTestCase): class TestProtonDriverLoad(test_utils.BaseTestCase):
def setUp(self): def setUp(self):
@ -86,7 +85,7 @@ class TestProtonDriverLoad(test_utils.BaseTestCase):
class _AmqpBrokerTestCase(test_utils.BaseTestCase): class _AmqpBrokerTestCase(test_utils.BaseTestCase):
@testtools.skipUnless(pyngus, "proton modules not present") @testtools.skipUnless(six.PY2, "No Py3K support yet")
def setUp(self): def setUp(self):
super(_AmqpBrokerTestCase, self).setUp() super(_AmqpBrokerTestCase, self).setUp()
self._broker = FakeBroker() self._broker = FakeBroker()
@ -295,7 +294,7 @@ class TestAmqpNotification(_AmqpBrokerTestCase):
driver.cleanup() driver.cleanup()
@testtools.skipUnless(pyngus, "proton modules not present") @testtools.skipUnless(six.PY2, "No Py3K support yet")
class TestAuthentication(test_utils.BaseTestCase): class TestAuthentication(test_utils.BaseTestCase):
def setUp(self): def setUp(self):
@ -349,7 +348,7 @@ class TestAuthentication(test_utils.BaseTestCase):
driver.cleanup() driver.cleanup()
@testtools.skipUnless(pyngus, "proton modules not present") @testtools.skipUnless(six.PY2, "No Py3K support yet")
class TestFailover(test_utils.BaseTestCase): class TestFailover(test_utils.BaseTestCase):
def setUp(self): def setUp(self):
@ -424,7 +423,7 @@ class TestFailover(test_utils.BaseTestCase):
class FakeBroker(threading.Thread): class FakeBroker(threading.Thread):
"""A test AMQP message 'broker'.""" """A test AMQP message 'broker'."""
if pyngus: if six.PY2:
class Connection(pyngus.ConnectionEventHandler): class Connection(pyngus.ConnectionEventHandler):
"""A single AMQP connection.""" """A single AMQP connection."""

View File

@ -7,6 +7,7 @@ setenv =
OS_TEST_TIMEOUT=30 OS_TEST_TIMEOUT=30
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
-r{toxinidir}/amqp1-requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}' commands = python setup.py testr --slowest --testr-args='{posargs}'
[testenv:pep8] [testenv:pep8]
@ -36,11 +37,8 @@ commands = {toxinidir}/setup-test-env-rabbit.sh python setup.py testr --slowest
[testenv:py27-func-amqp1] [testenv:py27-func-amqp1]
setenv = TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:65123// setenv = TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:65123//
deps = -r{toxinidir}/amqp1-requirements.txt # NOTE(flaper87): This gate job run on fedora21 for now.
{[testenv]deps} commands = {toxinidir}/setup-test-env-qpid.sh python setup.py testr --slowest --testr-args='oslo_messaging.tests.functional'
# NOTE(sileht): This gate job run in fedora21 because proton libs are not
# available on ubuntu yet,
commands = {toxinidir}/setup-test-env-qpid.sh python setup.py testr --slowest --testr-args='oslo_messaging.tests.(functional|test_amqp_driver)'
[testenv:py27-func-zeromq] [testenv:py27-func-zeromq]
commands = {toxinidir}/setup-test-env-zmq.sh python setup.py testr --slowest --testr-args='oslo_messaging.tests.functional' commands = {toxinidir}/setup-test-env-zmq.sh python setup.py testr --slowest --testr-args='oslo_messaging.tests.functional'