diff options
| author | Mark Goddard <mark@stackhpc.com> | 2019-04-25 11:18:35 +0100 |
|---|---|---|
| committer | Mark Goddard <mark@stackhpc.com> | 2019-11-07 18:03:07 +0000 |
| commit | ed996ef90d35fa1a75eea3b1c9ec4dcdc6193bd3 (patch) | |
| tree | 6c66e3932b1fd694806ce1204af668c358021ccd /tests/test-mariadb.sh | |
| parent | 56f355136afceefc28022b4e656faea394ddfbac (diff) | |
| download | kolla-ansible-ed996ef90d35fa1a75eea3b1c9ec4dcdc6193bd3.tar.gz kolla-ansible-ed996ef90d35fa1a75eea3b1c9ec4dcdc6193bd3.zip | |
CI: Add mariadb test
Tests the following operations for MariaDB:
* Stop
* Recovery
Backup and restore will be added in a separate change.
Depends-On: https://review.opendev.org/693329
Change-Id: I836d91554715cce0e82c1bbebb7430c457418b2d
Diffstat (limited to 'tests/test-mariadb.sh')
| -rwxr-xr-x | tests/test-mariadb.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/test-mariadb.sh b/tests/test-mariadb.sh new file mode 100755 index 000000000..6d26e994a --- /dev/null +++ b/tests/test-mariadb.sh @@ -0,0 +1,50 @@ +#!/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" + tools/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" + tools/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 |
