kolla-ansible/tests/test-mariadb.sh
Mark Goddard 1ea99147c1 CI: Use PATH to find kolla-ansible script
This change also updates the CI test scripts to use PATH to find the
kolla-ansible script, rather than relying on the file in the source
checkout.

Using the script in the source checkout was hiding an issue with pip
install --user, although that has now been fixed in
I5b47a146627d06bb3fe4a747c5f20290c726b0f9.

Related-Bug: #1915527

Change-Id: I2827a657c8716a9c40391c6bdb7ff1a2a9c1260e
Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/775586
2021-05-25 10:29:12 +01:00

51 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -o xtrace
set -o errexit
set -o nounset
set -o pipefail
# Enable unbuffered output for Ansible in Jenkins.
export PYTHONUNBUFFERED=1
function mariadb_stop {
echo "Stopping the database cluster"
kolla-ansible -i ${RAW_INVENTORY} -vvv stop --yes-i-really-really-mean-it --tags mariadb --skip-tags common
if [[ $(sudo docker ps -q | grep mariadb | wc -l) -ne 0 ]]; then
echo "Failed to stop MariaDB cluster"
return 1
fi
}
function mariadb_recovery {
# Recover the database cluster.
echo "Recovering the database cluster"
kolla-ansible -i ${RAW_INVENTORY} -vvv mariadb_recovery --tags mariadb --skip-tags common
}
function test_recovery {
# Stop all nodes in the cluster, then recover.
mariadb_stop
mariadb_recovery
}
function test_mariadb_logged {
RAW_INVENTORY=/etc/kolla/inventory
test_recovery
}
function test_mariadb {
echo "Testing MariaDB"
test_mariadb_logged > /tmp/logs/ansible/test-mariadb 2>&1
result=$?
if [[ $result != 0 ]]; then
echo "Testing MariaDB failed. See ansible/test-mariadb for details"
else
echo "Successfully tested MariaDB. See ansible/test-mariadb for details"
fi
return $result
}
test_mariadb