Merge "RabbitMQ: add test to ensure correct number of members in cluster"

This commit is contained in:
Zuul 2019-03-20 15:28:29 +00:00 committed by Gerrit Code Review
commit 87263a6e3c
2 changed files with 21 additions and 1 deletions

View File

@ -30,6 +30,24 @@ RABBITMQ_ADMIN_USERNAME=`echo $RABBITMQ_ADMIN_CONNECTION | awk -F'[@]' '{print $
RABBITMQ_ADMIN_PASSWORD=`echo $RABBITMQ_ADMIN_CONNECTION | awk -F'[@]' '{print $1}' \
| awk -F'[//:]' '{print $5}'`
function rabbit_check_node_count () {
echo "Checking node count "
NODES_IN_CLUSTER=$(rabbitmqadmin \
--host="${RABBIT_HOSTNAME}" \
--port="${RABBIT_PORT}" \
--username="${RABBITMQ_ADMIN_USERNAME}" \
--password="${RABBITMQ_ADMIN_PASSWORD}" \
list nodes -f bash | wc -w)
if [ "$NODES_IN_CLUSTER" -eq "$RABBIT_REPLICA_COUNT" ]; then
echo "Number of nodes in cluster match number of desired pods ($NODES_IN_CLUSTER)"
else
echo "Number of nodes in cluster ($NODES_IN_CLUSTER) does not match number of desired pods ($RABBIT_REPLICA_COUNT)"
exit 1
fi
}
# Check node count
rabbit_check_node_count
function rabbit_find_paritions () {
echo "Checking cluster partitions"
PARTITIONS=$(rabbitmqadmin \

View File

@ -41,7 +41,9 @@ spec:
{{ tuple $envAll "scripted_test" | include "helm-toolkit.snippets.image" | indent 6 }}
env:
- name: RABBITMQ_ADMIN_CONNECTION
value: "{{ tuple "oslo_messaging" "internal" "user" "http" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" }}"
value: {{ tuple "oslo_messaging" "internal" "user" "http" $envAll | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" | quote }}
- name: RABBIT_REPLICA_COUNT
value: {{ $envAll.Values.pod.replicas.server | quote }}
command:
- /tmp/rabbitmq-test.sh
volumeMounts: