53e8b80ed3
This patch add a way to choose container engine inside tool and test scripts. This is in preparation for Podman introduction but still leaves Docker as default container engine. Signed-off-by: Martin Hiner <m.hiner@partner.samsung.com> Change-Id: I395d2bdb0dfb4b325b6ad197c8893c8a0f768324
53 lines
1.3 KiB
Bash
Executable File
53 lines
1.3 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 ${container_engine} 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
|
|
source $KOLLA_ANSIBLE_VENV_PATH/bin/activate
|
|
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
|
|
}
|
|
|
|
container_engine="${1:-docker}"
|
|
test_mariadb
|