summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Percoco <flaper87@gmail.com>2015-05-29 10:14:19 +0200
committerFlavio Percoco <flaper87@gmail.com>2015-06-15 20:52:24 +0200
commitf06b19628fbb11a32797f1095eba7c07b6343433 (patch)
tree069171ca6ed2bcd1b2d487aabca6f41fd4cb536a
parent3800dd61c5a117b5a3efce485d738793df7f0132 (diff)
downloadoslo-messaging-f06b19628fbb11a32797f1095eba7c07b6343433.tar.gz
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
-rw-r--r--amqp1-requirements.txt12
-rwxr-xr-xoslo_messaging/tests/functional/gate/post_test_hook.sh11
-rw-r--r--tests/test_amqp_driver.py21
-rw-r--r--tox.ini8
4 files changed, 24 insertions, 28 deletions
diff --git a/amqp1-requirements.txt b/amqp1-requirements.txt
index 6303dc7..f5d6af0 100644
--- a/amqp1-requirements.txt
+++ b/amqp1-requirements.txt
@@ -1,9 +1,3 @@
-# TODO(kgiusti) AMQP 1.0 support depends on the Qpid Proton AMQP 1.0
-# development libraries. As these are not yet available from the
-# Ubuntu repositories, do not require these packages by default. If
-# 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
-
+# AMQP 1.0 support depends on the Qpid Proton AMQP 1.0
+# development libraries.
+pyngus>=1.3.1 # Apache-2.0
diff --git a/oslo_messaging/tests/functional/gate/post_test_hook.sh b/oslo_messaging/tests/functional/gate/post_test_hook.sh
index 378e95e..a3d2b82 100755
--- a/oslo_messaging/tests/functional/gate/post_test_hook.sh
+++ b/oslo_messaging/tests/functional/gate/post_test_hook.sh
@@ -33,6 +33,13 @@ sudo chown -R jenkins:stack $BASE/new/oslo.messaging
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
case $RPC_BACKEND in
zeromq)
@@ -44,9 +51,7 @@ case $RPC_BACKEND in
sudo apt-get install -y qpidd sasl2-bin
;;
amqp1)
- # qpid-tools is needed to ensure authentification works before
- # 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
+ sudo yum install -y qpid-cpp-server qpid-proton-c-devel python-qpid-proton cyrus-sasl-lib cyrus-sasl-plain
;;
rabbit)
sudo apt-get update -y
diff --git a/tests/test_amqp_driver.py b/tests/test_amqp_driver.py
index b2ebc33..df0a769 100644
--- a/tests/test_amqp_driver.py
+++ b/tests/test_amqp_driver.py
@@ -20,19 +20,18 @@ import threading
import time
import uuid
+import six
from six import moves
import testtools
from oslo import messaging
-from oslo.utils import importutils
from oslo_messaging.tests import utils as test_utils
-# TODO(kgiusti) Conditionally run these tests only if the necessary
-# dependencies are installed. This should be removed once the proton libraries
-# are available in the base repos for all supported platforms.
-pyngus = importutils.try_import("pyngus")
-if pyngus:
+if six.PY2:
+ # NOTE(flaper87): pyngus currently doesn't support py34. It's
+ # on the works, though.
from oslo_messaging._drivers.protocols.amqp import driver as amqp_driver
+ import pyngus
LOG = logging.getLogger(__name__)
@@ -71,7 +70,7 @@ class _ListenerThread(threading.Thread):
return msgs
-@testtools.skipUnless(pyngus, "proton modules not present")
+@testtools.skipUnless(six.PY2, "No Py3K support yet")
class TestProtonDriverLoad(test_utils.BaseTestCase):
def setUp(self):
@@ -86,7 +85,7 @@ class TestProtonDriverLoad(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):
super(_AmqpBrokerTestCase, self).setUp()
self._broker = FakeBroker()
@@ -295,7 +294,7 @@ class TestAmqpNotification(_AmqpBrokerTestCase):
driver.cleanup()
-@testtools.skipUnless(pyngus, "proton modules not present")
+@testtools.skipUnless(six.PY2, "No Py3K support yet")
class TestAuthentication(test_utils.BaseTestCase):
def setUp(self):
@@ -349,7 +348,7 @@ class TestAuthentication(test_utils.BaseTestCase):
driver.cleanup()
-@testtools.skipUnless(pyngus, "proton modules not present")
+@testtools.skipUnless(six.PY2, "No Py3K support yet")
class TestFailover(test_utils.BaseTestCase):
def setUp(self):
@@ -424,7 +423,7 @@ class TestFailover(test_utils.BaseTestCase):
class FakeBroker(threading.Thread):
"""A test AMQP message 'broker'."""
- if pyngus:
+ if six.PY2:
class Connection(pyngus.ConnectionEventHandler):
"""A single AMQP connection."""
diff --git a/tox.ini b/tox.ini
index 842453c..6c86be9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,6 +7,7 @@ setenv =
OS_TEST_TIMEOUT=30
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
+ -r{toxinidir}/amqp1-requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}'
[testenv:pep8]
@@ -36,11 +37,8 @@ commands = {toxinidir}/setup-test-env-rabbit.sh python setup.py testr --slowest
[testenv:py27-func-amqp1]
setenv = TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:65123//
-deps = -r{toxinidir}/amqp1-requirements.txt
- {[testenv]deps}
-# 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)'
+# NOTE(flaper87): This gate job run on fedora21 for now.
+commands = {toxinidir}/setup-test-env-qpid.sh python setup.py testr --slowest --testr-args='oslo_messaging.tests.functional'
[testenv:py27-func-zeromq]
commands = {toxinidir}/setup-test-env-zmq.sh python setup.py testr --slowest --testr-args='oslo_messaging.tests.functional'