summaryrefslogtreecommitdiffstats
path: root/tests/omamqp1-common.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
commitdcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch)
tree66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/omamqp1-common.sh
parentInitial commit. (diff)
downloadrsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz
rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/omamqp1-common.sh')
-rw-r--r--tests/omamqp1-common.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/omamqp1-common.sh b/tests/omamqp1-common.sh
new file mode 100644
index 0000000..ec0a6ae
--- /dev/null
+++ b/tests/omamqp1-common.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# version of qdrouterd to use for test
+QDROUTERD_VERSION=${QDROUTERD_VERSION:-1.7.0}
+# Use of containers isn't necessary for CI, and might not be
+# useful for devs, depending on platform availability.
+# If not using a container for the test, the
+# package will be installed using the platform
+# package manager.
+#USE_CONTAINER=${USE_CONTAINER:-false}
+#CONTAINER_URL=${CONTAINER_URL:-quay.io/interconnectedcloud/qdrouterd:$QDROUTERD_VERSION}
+
+if ! type -p qdrouterd ; then
+ echo no qdrouterd found in PATH $PATH - skipping test
+ exit 0
+fi
+
+ver=$( qdrouterd --version )
+if [ "$ver" = $QDROUTERD_VERSION ] ; then
+ echo found qdrouterd version $ver - continuing
+else
+ echo found qdrouterd version $ver but expected version $QDROUTERD_VERSION - skipping test
+ exit 0
+fi
+
+AMQP_SIMPLE_RECV=${AMQP_SIMPLE_RECV:-/usr/share/proton-0.28.0/examples/python/simple_recv.py}
+
+if [ -f $AMQP_SIMPLE_RECV ] ; then
+ echo found $AMQP_SIMPLE_RECV
+else
+ echo no amqp client $AMQP_SIMPLE_RECV - skipping test
+ exit 0
+fi
+
+AMQP_PYTHON=${AMQP_PYTHON:-python}
+if $AMQP_PYTHON $AMQP_SIMPLE_RECV --help > /dev/null 2>&1 ; then
+ : # good
+elif python3 $AMQP_SIMPLE_RECV --help > /dev/null 2>&1 ; then
+ AMQP_PYTHON=python3
+else
+ echo missing python modules for $AMQP_SIMPLE_RECV - skipping test
+ exit 0
+fi
+
+amqp_simple_recv() {
+ # $1 is host:port (or amqp url if applicable)
+ # $2 is target (e.g. amq.rsyslogtest)
+ # $3 is number of messages to read
+ stdbuf -o 0 $AMQP_PYTHON $AMQP_SIMPLE_RECV -a $1/$2 -m $3
+}