RabbitMQ: add test to ensure correct number of members in cluster
This PS adds a test to ensure the correct number of members in a cluster. Change-Id: I52d0fcc473322fb9a754e95a2977a5c2cfad6b45 Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
parent
6a1a46a8ce
commit
7077f717f1
@ -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 \
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user