[CI] Add mariadb backup into mariadb scenario
We are not testing mariadb backup, let's test it in mariadb scenario. Change-Id: I81d6ee944b3ed0e75129772bb993ce7a6147c3e8
This commit is contained in:
parent
49cebeaf4d
commit
50cc656d60
@ -133,6 +133,7 @@ enable_fluentd: "yes"
|
||||
enable_mariadb: "yes"
|
||||
enable_memcached: "no"
|
||||
enable_rabbitmq: "no"
|
||||
enable_mariabackup: "yes"
|
||||
{% endif %}
|
||||
|
||||
{% if scenario == "cephadm" %}
|
||||
|
@ -30,9 +30,57 @@ function test_recovery {
|
||||
mariadb_recovery
|
||||
}
|
||||
|
||||
function test_backup {
|
||||
echo "Performing full backup"
|
||||
kolla-ansible -i ${RAW_INVENTORY} -vvv mariadb_backup --full
|
||||
# Sleep for 30 seconds, not because it's absolutely necessary.
|
||||
# The full backup is already completed at this point, as the
|
||||
# ansible job is waiting for the completion of the backup script
|
||||
# in the container on the controller side. It’s more of an
|
||||
# attempt at a "sort of" simulation of the usual elapsed time
|
||||
# since the last full backup for the incremental job, as some
|
||||
# data gets written within those 30 seconds.
|
||||
echo "Sleeping for 30 seconds"
|
||||
sleep 30
|
||||
kolla-ansible -i ${RAW_INVENTORY} -vvv mariadb_backup --incremental
|
||||
}
|
||||
|
||||
function test_backup_with_retries {
|
||||
# Retry test_backup up to 3 times if it fails
|
||||
local max_retries=3
|
||||
local attempt=1
|
||||
|
||||
while [[ $attempt -le $max_retries ]]; do
|
||||
echo "Attempt $attempt of $max_retries for test_backup"
|
||||
|
||||
set +o errexit # Temporarily disable errexit for retry logic
|
||||
test_backup
|
||||
result=$?
|
||||
set -o errexit # Re-enable errexit after the attempt
|
||||
|
||||
if [[ $result -eq 0 ]]; then
|
||||
echo "test_backup succeeded on attempt $attempt"
|
||||
return 0 # Exit the function if test_backup succeeds
|
||||
else
|
||||
echo "test_backup failed on attempt $attempt"
|
||||
fi
|
||||
|
||||
if [[ $attempt -lt $max_retries ]]; then
|
||||
echo "Sleeping for 30 seconds before the next attempt"
|
||||
sleep 30 # Wait for 30 seconds before retrying
|
||||
fi
|
||||
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
|
||||
echo "test_backup failed after $max_retries attempts"
|
||||
return 1 # Return an error if all attempts fail
|
||||
}
|
||||
|
||||
function test_mariadb_logged {
|
||||
RAW_INVENTORY=/etc/kolla/inventory
|
||||
source $KOLLA_ANSIBLE_VENV_PATH/bin/activate
|
||||
test_backup_with_retries
|
||||
test_recovery
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user