From c5d142b441fdaae562d7466a3b2c65eb40eb3ed2 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Thu, 25 Aug 2016 15:52:18 -0400 Subject: [PATCH] [AMQP 1.0] Update setup test environment dispatch router backend This commit updates the setup environment for the driver functional tests to support either a qpidd (broker) or qdrouterd (router) backend. This patch: * configures and runs either qpidd or qdrouterd backend * removes support of older qpidd versions * skips batch notification test for qdrouterd backend Change-Id: Ifcdc187bae4a28dd29c1faa73e239d7e4d77015d --- .../tests/functional/test_functional.py | 8 + setup-test-env-amqp1.sh | 191 ++++++++++++++++++ setup-test-env-qpid.sh | 115 ----------- tox.ini | 24 ++- 4 files changed, 217 insertions(+), 121 deletions(-) create mode 100755 setup-test-env-amqp1.sh delete mode 100755 setup-test-env-qpid.sh diff --git a/oslo_messaging/tests/functional/test_functional.py b/oslo_messaging/tests/functional/test_functional.py index 39422f578..e1e90205d 100644 --- a/oslo_messaging/tests/functional/test_functional.py +++ b/oslo_messaging/tests/functional/test_functional.py @@ -11,6 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. +import os import time import uuid @@ -331,6 +332,13 @@ class NotifyTestCase(utils.SkipIfNoTransportURL): self.assertEqual(expected[3], actual[2]) def test_simple_batch(self): + if self.url.startswith("amqp:"): + backend = os.environ.get("AMQP1_BACKEND") + if backend == "qdrouterd": + # end-to-end acknowledgement with router intermediary + # sender pends until batch_size or timeout reached + self.skipTest("qdrouterd backend") + listener = self.useFixture( utils.BatchNotificationFixture(self.conf, self.url, ['test_simple_batch'], diff --git a/setup-test-env-amqp1.sh b/setup-test-env-amqp1.sh new file mode 100755 index 000000000..0ecfd0dd7 --- /dev/null +++ b/setup-test-env-amqp1.sh @@ -0,0 +1,191 @@ +#!/bin/bash +# +# Usage: setup-test-env-amqp.sh +# where AMQP1_BACKEND is the AMQP 1.0 intermediary to use. Valid +# values are "qdrouterd" for router and "qpidd" for broker. +set -e + +# router requires qdrouterd, sasl2-bin/cyrus-sasl-plain+cyrus-sasl-lib +# broker requires qpidd, qpid-tools sasl2-bin/cyrus-sasl-plain+cyrus-sasl-lib + +. tools/functions.sh + +DATADIR=$(mktemp -d /tmp/OSLOMSG-${AMQP1_BACKEND}.XXXXX) +trap "clean_exit $DATADIR" EXIT + +function _setup_qdrouterd_user { + echo secretqpid | saslpasswd2 -c -p -f ${DATADIR}/qdrouterd.sasldb stackqpid +} + +function _setup_qpidd_user { + echo secretqpid | saslpasswd2 -c -p -f ${DATADIR}/qpidd.sasldb -u QPID stackqpid +} + +function _configure_qdrouterd { + # create a stand alone router + cat > ${DATADIR}/qdrouterd.conf <> ${DATADIR}/qdrouterd.conf <> ${DATADIR}/qdrouterd.conf <> ${DATADIR}/qdrouterd.conf < ${DATADIR}/sasl2/qdrouterd.conf < ${DATADIR}/qpidd.conf </dev/null) --help | grep -q "sasl-service-name"`; then + echo "This version of $QPIDD does not support SASL authentication with AMQP 1.0" + cat >> ${DATADIR}/qpidd.conf <> ${DATADIR}/qpidd.conf <> ${DATADIR}/qpidd.conf < ${DATADIR}/qpidd.acl < ${DATADIR}/sasl2/qpidd.conf < ${SITEDIR}/dispatch.pth </dev/null) + mkfifo ${DATADIR}/out + $QDR --config ${DATADIR}/qdrouterd.conf & + wait_for_line "Router .*started" "error" ${DATADIR}/out + rm ${SITEDIR}/dispatch.pth +} + +function _start_qpidd { + QPIDD=$(which qpidd 2>/dev/null) + mkfifo ${DATADIR}/out + $QPIDD --log-enable trace+ --log-to-file ${DATADIR}/out --config ${DATADIR}/qpidd.conf & + wait_for_line "Broker .*running" "error" ${DATADIR}/out +} + +_configure_${AMQP1_BACKEND} +_setup_${AMQP1_BACKEND}_user +_start_${AMQP1_BACKEND} + +$* diff --git a/setup-test-env-qpid.sh b/setup-test-env-qpid.sh deleted file mode 100755 index c66d85cd5..000000000 --- a/setup-test-env-qpid.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -# -# Usage: setup-test-env-qpid.sh PROTOCOL -# where PROTOCOL is the version of the AMQP protocol to use with -# qpidd. Valid values for PROTOCOL are "1", "1.0", "0-10", "0.10" -set -e - -# require qpidd, qpid-tools sasl2-bin/cyrus-sasl-plain+cyrus-sasl-lib - -. tools/functions.sh - -DATADIR=$(mktemp -d /tmp/OSLOMSG-QPID.XXXXX) -trap "clean_exit $DATADIR" EXIT - -QPIDD=$(which qpidd 2>/dev/null) - -# which protocol should be used with qpidd? -# 1 for AMQP 1.0, 0.10 for AMQP 0.10 -# -PROTOCOL=$1 -case $PROTOCOL in - "1" | "1.0") - PROTOCOL="1" - shift - ;; - "0.10" | "0-10") - PROTOCOL="0-10" - shift - ;; - *) - # assume the old protocol - echo "No protocol specified, assuming 0.10" - PROTOCOL="0-10" - ;; -esac - -# ensure that the version of qpidd does support AMQP 1.0 -if [ $PROTOCOL == "1" ] && ! `$QPIDD --help | grep -q "queue-patterns"`; then - echo "This version of $QPIDD does not support AMQP 1.0" - exit 1 -fi - -[ -f "/usr/lib/qpid/daemon/acl.so" ] && LIBACL="load-module=/usr/lib/qpid/daemon/acl.so" - -cat > ${DATADIR}/qpidd.conf <=0.10). If this version of qpidd does -# not support the fix, then do not require authentication - -if [ $PROTOCOL == "1" ] && ! `$QPIDD --help | grep -q "sasl-service-name"`; then - echo "This version of $QPIDD does not support SASL authentication with AMQP 1.0" - cat >> ${DATADIR}/qpidd.conf <> ${DATADIR}/qpidd.conf <> ${DATADIR}/qpidd.conf <0.32 require this for AMQP 1 and SASL: - if `$QPIDD --help | grep -q "sasl-service-name"`; then - cat >> ${DATADIR}/qpidd.conf < ${DATADIR}/qpidd.acl < ${DATADIR}/sasl2/qpidd.conf <> ${DATADIR}/sasl2/qpidd.conf <> ${DATADIR}/sasl2/qpidd.conf <