aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMark Goddard <mark@stackhpc.com>2019-04-25 11:18:35 +0100
committerMark Goddard <mark@stackhpc.com>2019-11-07 18:03:07 +0000
commited996ef90d35fa1a75eea3b1c9ec4dcdc6193bd3 (patch)
tree6c66e3932b1fd694806ce1204af668c358021ccd /tests
parent56f355136afceefc28022b4e656faea394ddfbac (diff)
downloadkolla-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')
-rwxr-xr-xtests/deploy.sh6
-rw-r--r--tests/run.yml11
-rw-r--r--tests/templates/globals-default.j29
-rwxr-xr-xtests/test-mariadb.sh50
4 files changed, 74 insertions, 2 deletions
diff --git a/tests/deploy.sh b/tests/deploy.sh
index f54e67cdf..2ad9769f2 100755
--- a/tests/deploy.sh
+++ b/tests/deploy.sh
@@ -23,6 +23,12 @@ function deploy {
tools/kolla-ansible -i ${RAW_INVENTORY} -vvv post-deploy &> /tmp/logs/ansible/post-deploy
tools/kolla-ansible -i ${RAW_INVENTORY} -vvv check &> /tmp/logs/ansible/check-deploy
+ if [[ ${ACTION} != "mariadb" ]]; then
+ init_runonce
+ fi
+}
+
+function init_runonce {
. /etc/kolla/admin-openrc.sh
. ~/openstackclient-venv/bin/activate
diff --git a/tests/run.yml b/tests/run.yml
index 769b5a9ec..6c00ac340 100644
--- a/tests/run.yml
+++ b/tests/run.yml
@@ -113,7 +113,7 @@
# nova-compute.conf
- src: "tests/templates/nova-compute-overrides.j2"
dest: /etc/kolla/config/nova/nova-compute.conf
- when: "{{ scenario != 'bifrost' }}"
+ when: "{{ scenario not in ['bifrost', 'mariadb'] }}"
# ceph.conf
- src: "tests/templates/ceph-overrides.j2"
dest: /etc/kolla/config/ceph.conf
@@ -218,7 +218,7 @@
chdir: "{{ kolla_ansible_src_dir }}"
environment:
ACTION: "{{ scenario }}"
- when: scenario not in ['ironic', 'scenario_nfv']
+ when: scenario not in ['ironic', 'mariadb', 'scenario_nfv']
- name: Run test-zun.sh script
shell:
@@ -248,6 +248,13 @@
chdir: "{{ kolla_ansible_src_dir }}"
when: scenario == "masakari"
+ - name: Run test-mariadb.sh script
+ script:
+ cmd: test-mariadb.sh
+ executable: /bin/bash
+ chdir: "{{ kolla_ansible_src_dir }}"
+ when: scenario == "mariadb"
+
- name: Run reconfigure.sh script
script:
cmd: reconfigure.sh
diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2
index b0f5718fd..5d495620b 100644
--- a/tests/templates/globals-default.j2
+++ b/tests/templates/globals-default.j2
@@ -103,3 +103,12 @@ enable_masakari: "yes"
{% if scenario == "cells" %}
enable_cells: "yes"
{% endif %}
+
+{% if scenario == "mariadb" %}
+enable_chrony: "no"
+enable_fluentd: "no"
+enable_mariadb: "yes"
+enable_memcached: "no"
+enable_openstack_core: "no"
+enable_rabbitmq: "no"
+{% endif %}
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