This adds a setup script for each tox functional target to start a rabbitmq-server, qpidd or redis daemon dedicated for the functional testing. This script is responsible to spawn a preconfigured daemon needed for the functional tests. This also changes the gate script to just install the required packages instead of setup a devstack. This also fixes the zmq config options loading in tests Closes-bug: #1442612 Change-Id: I27eb2c1d3d0ca67aa361c83e41372138e03d9bddchanges/85/190185/23
parent
2e5ba4538e
commit
80ece65a54
@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
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
|
||||
|
||||
[ -f "/usr/lib/qpid/daemon/acl.so" ] && LIBACL="load-module=/usr/lib/qpid/daemon/acl.so"
|
||||
|
||||
cat > ${DATADIR}/qpidd.conf <<EOF
|
||||
port=65123
|
||||
acl-file=${DATADIR}/qpidd.acl
|
||||
sasl-config=${DATADIR}/sasl2
|
||||
log-to-file=${DATADIR}/log
|
||||
${LIBACL}
|
||||
mgmt-enable=yes
|
||||
auth=yes
|
||||
|
||||
# Used by AMQP1.0 only
|
||||
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
|
||||
EOF
|
||||
|
||||
echo secretqpid | saslpasswd2 -c -p -f ${DATADIR}/qpidd.sasldb -u QPID stackqpid
|
||||
|
||||
QPIDD=$(which qpidd 2>/dev/null)
|
||||
[ ! -x $QPIDD ] && /usr/sbin/qpidd
|
||||
|
||||
mkfifo ${DATADIR}/out
|
||||
$QPIDD --config ${DATADIR}/qpidd.conf &> ${DATADIR}/out &
|
||||
wait_for_line "Broker .*running" "error" ${DATADIR}/out
|
||||
|
||||
# Earlier failure if qpid-config is avialable
|
||||
[ -x "$(which qpid-config)" ] && qpid-config -b stackqpid/secretqpid@localhost:65123
|
||||
|
||||
$*
|
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
. tools/functions.sh
|
||||
|
||||
DATADIR=$(mktemp -d /tmp/OSLOMSG-RABBIT.XXXXX)
|
||||
trap "clean_exit $DATADIR" EXIT
|
||||
|
||||
export RABBITMQ_NODE_IP_ADDRESS=127.0.0.1
|
||||
export RABBITMQ_NODE_PORT=65123
|
||||
export RABBITMQ_NODENAME=oslomsg-test@localhost
|
||||
export RABBITMQ_LOG_BASE=$DATADIR
|
||||
export RABBITMQ_MNESIA_BASE=$DATADIR
|
||||
export RABBITMQ_PID_FILE=$DATADIR/pid
|
||||
export HOME=$DATADIR
|
||||
|
||||
# NOTE(sileht): We directly use the rabbitmq scripts
|
||||
# to avoid distribution check, like running as root/rabbitmq
|
||||
# enforcing.
|
||||
export PATH=/usr/lib/rabbitmq/bin/:$PATH
|
||||
|
||||
|
||||
mkfifo ${DATADIR}/out
|
||||
rabbitmq-server &> ${DATADIR}/out &
|
||||
wait_for_line "Starting broker... completed" "ERROR:" ${DATADIR}/out
|
||||
|
||||
rabbitmqctl add_user oslomsg oslosecret
|
||||
rabbitmqctl set_permissions "oslomsg" ".*" ".*" ".*"
|
||||
|
||||
|
||||
export TRANSPORT_URL=rabbit://oslomsg:oslosecret@127.0.0.1:65123//
|
||||
$*
|
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
. tools/functions.sh
|
||||
|
||||
DATADIR=$(mktemp -d /tmp/OSLOMSG-ZEROMQ.XXXXX)
|
||||
trap "clean_exit $DATADIR" EXIT
|
||||
|
||||
export TRANSPORT_URL=zmq://
|
||||
export ZMQ_MATCHMAKER=redis
|
||||
export ZMQ_REDIS_PORT=65123
|
||||
export ZMQ_IPC_DIR=${DATADIR}
|
||||
|
||||
cat > ${DATADIR}/zmq.conf <<EOF
|
||||
[DEFAULT]
|
||||
transport_url=${TRANSPORT_URL}
|
||||
rpc_zmq_matchmaker=${ZMQ_MATCHMAKER}
|
||||
rpc_zmq_ipc_dir=${ZMQ_IPC_DIR}
|
||||
[matchmaker_redis]
|
||||
port=${ZMQ_REDIS_PORT}
|
||||
EOF
|
||||
|
||||
redis-server --port $ZMQ_REDIS_PORT &
|
||||
|
||||
oslo-messaging-zmq-receiver --config-file ${DATADIR}/zmq.conf > ${DATADIR}/receiver.log 2>&1 &
|
||||
|
||||
# FIXME(sileht): This does the same kind of setup that devstack does
|
||||
# But this doesn't work yet, a zeromq maintener should take a look on that
|
||||
|
||||
$*
|
@ -0,0 +1,19 @@
|
||||
|
||||
wait_for_line () {
|
||||
while read line
|
||||
do
|
||||
echo "$line" | grep -q "$1" && break
|
||||
echo "$line" | grep "$2" && exit 1
|
||||
done < "$3"
|
||||
# Read the fifo for ever otherwise process would block
|
||||
cat "$3" >/dev/null &
|
||||
}
|
||||
|
||||
function clean_exit(){
|
||||
local error_code="$?"
|
||||
kill -9 $(jobs -p)
|
||||
rm -rf "$1"
|
||||
return $error_code
|
||||
}
|
||||
|
||||
|
Loading…
Reference in new issue