Merge "Update messaging intermediaries for amqp1 tests"

This commit is contained in:
Zuul 2019-04-17 15:14:01 +00:00 committed by Gerrit Code Review
commit 81e9d81770
6 changed files with 28 additions and 210 deletions

View File

@ -15,20 +15,21 @@ rabbitmq-server [platform:dpkg rabbit]
rabbitmq-server [platform:rpm rabbit]
# AMQP1 dpkg
qpidd [platform:dpkg amqp1]
qdrouterd [platform:dpkg amqp1]
sasl2-bin [platform:dpkg amqp1]
uuid-dev [platform:dpkg amqp1]
swig [platform:dpkg amqp1]
libsasl2-modules [platform:dpkg amqp1]
openjdk-8-jdk [platform:dpkg amqp1]
# AMQP1 rpm
qpid-cpp-server [platform:rpm amqp1]
qpid-proton-c-devel [platform:rpm amqp1]
qpid-dispatch-router [platform:rpm amqp1]
python-qpid-proton [platform:rpm amqp1]
cyrus-sasl-lib [platform:rpm amqp1]
cyrus-sasl-plain [platform:rpm amqp1]
libuuid-devel [platform:rpm amqp1]
swig [platform:rpm amqp1]
java-1.8.0-openjdk [platform:rpm amqp1]
# kafka dpkg
openjdk-8-jdk [platform:dpkg kafka]

View File

@ -54,7 +54,7 @@ Paste==2.0.2
PasteDeploy==1.5.0
pbr==2.0.0
pep8==1.5.7
pifpaf==0.10.0
pifpaf==2.2.0
prettytable==0.7.2
pycparser==2.18
pyflakes==0.8.1

View File

@ -35,7 +35,6 @@ that traffic can be partitioned based on its use.
import abc
import logging
from oslo_messaging._i18n import _LW
from oslo_messaging.target import Target
__all__ = [
@ -276,15 +275,6 @@ class AddresserFactory(object):
# overridden via the configuration.
product = remote_properties.get('product', 'qpid-cpp')
# TODO(kgiusti): Router support was added in Newton. Remove this
# warning post Newton, once the driver has stabilized.
if product == "qpid-dispatch-router":
w = _LW("This is the initial release of support for message"
" routing technology. Be aware that messages are not"
" queued and may be discarded if there are no consumers"
" present.")
LOG.warning(w)
if self._mode == 'legacy' or (self._mode == 'dynamic' and
product == 'qpid-cpp'):
return LegacyAddresser(self._default_exchange,

View File

@ -11,7 +11,7 @@ stestr>=2.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT
oslotest>=3.2.0 # Apache-2.0
pifpaf>=0.10.0 # Apache-2.0
pifpaf>=2.2.0 # Apache-2.0
# for test_impl_kafka
confluent-kafka>=0.11.6 # Apache-2.0

View File

@ -1,212 +1,41 @@
#!/bin/bash
#
# Usage: setup-test-env-amqp.sh <command to run>
# where AMQP1_BACKEND is the AMQP 1.0 intermediary to use. Valid
# values are "qdrouterd" for router and "qpidd" for broker.
# Configuration files for the qdrouterd and artemis backends generated
# by pifpaf driver fixtures (https://github.com/jd/pifpaf)
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
ARTEMIS_VERSION=${ARTEMIS_VERSION:-"2.6.4"}
function _setup_qdrouterd_user {
echo secretqpid | saslpasswd2 -c -p -f ${DATADIR}/qdrouterd.sasldb stackqpid
}
if [[ -z "$(which artemis)" ]]; then
DATADIR=$(mktemp -d /tmp/OSLOMSG-ARTEMIS.XXXXX)
trap "clean_exit $DATADIR" EXIT
function _setup_qpidd_user {
echo secretqpid | saslpasswd2 -c -p -f ${DATADIR}/qpidd.sasldb -u QPID stackqpid
}
tarball=apache-artemis-${ARTEMIS_VERSION}-bin.tar.gz
function _configure_qdrouterd {
QDR=$(type -p qdrouterd)
if [[ ! -x "$QDR" ]]; then
echo "FAILURE: Qpid Dispatch Router (qdrouterd) not installed"
exit 1
fi
# create a stand alone router
cat > ${DATADIR}/qdrouterd.conf <<EOF
router {
mode: standalone
id: Router.A
workerThreads: 4
saslConfigPath: ${DATADIR}/sasl2
saslConfigName: qdrouterd
}
EOF
# create a listener for incoming connect to the router
# ip address field name changed to 'host' at 1.0+
local field_name
field_name=$([[ $($QDR -v) == 0.*.* ]] && echo addr || echo host)
cat >> ${DATADIR}/qdrouterd.conf <<EOF
listener {
${field_name}: 0.0.0.0
port: 65123
role: normal
authenticatePeer: yes
}
EOF
# create fixed address prefixes
cat >> ${DATADIR}/qdrouterd.conf <<EOF
address {
prefix: unicast
distribution: closest
}
address {
prefix: exclusive
distribution: closest
}
address {
prefix: broadcast
distribution: multicast
}
address {
prefix: openstack.org/om/rpc/multicast
distribution: multicast
}
address {
prefix: openstack.org/om/rpc/unicast
distribution: closest
}
address {
prefix: openstack.org/om/rpc/anycast
distribution: balanced
}
address {
prefix: openstack.org/om/notify/multicast
distribution: multicast
}
address {
prefix: openstack.org/om/notify/unicast
distribution: closest
}
address {
prefix: openstack.org/om/notify/anycast
distribution: balanced
}
EOF
# create log file configuration
cat >> ${DATADIR}/qdrouterd.conf <<EOF
log {
module: DEFAULT
enable: trace+
output: ${DATADIR}/out
}
EOF
# sasl2 config
mkdir -p ${DATADIR}/sasl2
cat > ${DATADIR}/sasl2/qdrouterd.conf <<EOF
pwcheck_method: auxprop
auxprop_plugin: sasldb
sasldb_path: ${DATADIR}/qdrouterd.sasldb
mech_list: PLAIN ANONYMOUS
EOF
}
function _configure_qpidd {
QPIDD=$(which qpidd 2>/dev/null)
if [[ ! -x "$QPIDD" ]]; then
echo "FAILURE: qpidd broker not installed"
exit 1
fi
[ -f "/usr/lib/qpid/daemon/acl.so" ] && LIBACL="load-module=/usr/lib/qpid/daemon/acl.so"
cat > ${DATADIR}/qpidd.conf <<EOF
port=65123
sasl-config=${DATADIR}/sasl2
${LIBACL}
mgmt-enable=yes
log-to-stderr=no
data-dir=${DATADIR}/.qpidd
pid-dir=${DATADIR}/.qpidd
EOF
if ! `$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 <<EOF
auth=no
EOF
else
cat >> ${DATADIR}/qpidd.conf <<EOF
auth=yes
acl-file=${DATADIR}/qpidd.acl
sasl-service-name=amqp
EOF
wget http://archive.apache.org/dist/activemq/activemq-artemis/${ARTEMIS_VERSION}/$tarball -O $DATADIR/$tarball
tar -xzf $DATADIR/$tarball -C $DATADIR
export PATH=$DATADIR/apache-artemis-${ARTEMIS_VERSION}/bin:$PATH
fi
cat >> ${DATADIR}/qpidd.conf <<EOF
queue-patterns=exclusive
queue-patterns=unicast
topic-patterns=broadcast
EOF
cat > ${DATADIR}/qpidd.acl <<EOF
group admin stackqpid@QPID
acl allow admin all
acl deny all all
EOF
mkdir -p ${DATADIR}/sasl2
cat > ${DATADIR}/sasl2/qpidd.conf <<EOF
pwcheck_method: auxprop
auxprop_plugin: sasldb
sasldb_path: ${DATADIR}/qpidd.sasldb
mech_list: PLAIN ANONYMOUS
sql_select: dummy select
EOF
}
function _start_qdrouterd {
# TODO(ansmith) look to move this to pifpaf driver
function _setup_global_site_package_path {
MAJOR=$(python -c 'import sys; print(sys.version_info.major)')
MINOR=$(python -c 'import sys; print(sys.version_info.minor)')
if [ -f "/etc/debian_version" ]; then
PRE="dist"
else
PRE="site"
fi
# qdrouterd needs access to global site packages
# create path file and place in virtual env working directory
SITEDIR=${WORKDIR}/${ENVNAME}/lib/python${MAJOR}.${MINOR}/site-packages
cat > ${SITEDIR}/dispatch.pth <<EOF
/usr/lib/python${MAJOR}.${MINOR}/site-packages
/usr/lib/python${MAJOR}.${MINOR}/${PRE}-packages
EOF
QDR=$(which qdrouterd 2>/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 {
chmod -R a+r ${DATADIR}
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}
$*
_setup_global_site_package_path
pifpaf --env-prefix ARTEMIS run artemis -- pifpaf --debug --env-prefix QDR run qdrouterd --username stackqpid --password secretqpid -- $*

View File

@ -67,8 +67,7 @@ commands = {toxinidir}/setup-test-env-kafka.sh stestr run --slowest {posargs:osl
basepython = python2.7
setenv =
{[testenv]setenv}
TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:65123//
AMQP1_BACKEND=qpidd
TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:5672//
ENVNAME={envname}
WORKDIR={toxworkdir}
commands = {toxinidir}/tools/setup-test-env-amqp1.sh stestr run --slowest {posargs:oslo_messaging.tests.functional}
@ -77,8 +76,7 @@ commands = {toxinidir}/tools/setup-test-env-amqp1.sh stestr run --slowest {posar
basepython = python3.5
setenv =
{[testenv]setenv}
TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:65123//
AMQP1_BACKEND=qpidd
TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:5672//
ENVNAME={envname}
WORKDIR={toxworkdir}
commands = {toxinidir}/tools/setup-test-env-amqp1.sh stestr run --slowest {posargs:oslo_messaging.tests.functional}