aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-03-23 12:28:52 +0000
committerGerrit Code Review <review@openstack.org>2022-03-23 12:28:52 +0000
commitc02f8586e70d5037816becc437a591b3365f9a96 (patch)
tree701036e937c2f1425cb7f8bec8ba115c7e72bfcc /tests
parentce0a7a50707591c080434f7a2dc80138a9c4b255 (diff)
parent74ec1fab2a9239ab035311f01a15c24561952f4e (diff)
downloadkolla-ansible-c02f8586e70d5037816becc437a591b3365f9a96.tar.gz
kolla-ansible-c02f8586e70d5037816becc437a591b3365f9a96.zip
Merge "[CI] Add Venus scenario"
Diffstat (limited to 'tests')
-rw-r--r--tests/run.yml9
-rwxr-xr-xtests/setup_gate.sh5
-rw-r--r--tests/templates/globals-default.j25
-rwxr-xr-xtests/test-venus.sh94
4 files changed, 112 insertions, 1 deletions
diff --git a/tests/run.yml b/tests/run.yml
index f52881eaf..107c8bd2d 100644
--- a/tests/run.yml
+++ b/tests/run.yml
@@ -10,7 +10,7 @@
- name: set facts for commonly used variables
vars:
# NOTE(yoctozepto): needed here to use in other facts too
- openstack_core_enabled: "{{ scenario not in ['bifrost', 'mariadb', 'prometheus-efk', 'monasca'] }}"
+ openstack_core_enabled: "{{ scenario not in ['bifrost', 'mariadb', 'prometheus-efk', 'monasca', 'venus'] }}"
set_fact:
kolla_inventory_path: "/etc/kolla/inventory"
logs_dir: "/tmp/logs"
@@ -519,6 +519,13 @@
chdir: "{{ kolla_ansible_src_dir }}"
when: scenario == "prometheus-efk"
+ - name: Run test-venus.sh script
+ script:
+ cmd: test-venus.sh
+ executable: /bin/bash
+ chdir: "{{ kolla_ansible_src_dir }}"
+ when: scenario == "venus"
+
when: scenario != "bifrost"
# NOTE(yoctozepto): each host checks itself
diff --git a/tests/setup_gate.sh b/tests/setup_gate.sh
index db7c81d58..0318e838d 100755
--- a/tests/setup_gate.sh
+++ b/tests/setup_gate.sh
@@ -101,6 +101,11 @@ function prepare_images {
# FIXME(mgoddard): No need for OpenStack core images.
GATE_IMAGES+=",^elasticsearch,^grafana,^influxdb,^kafka,^kibana,^logstash,^monasca,^storm,^zookeeper"
fi
+
+ if [[ $SCENARIO == "venus" ]]; then
+ GATE_IMAGES="^cron,^elasticsearch,^fluentd,^haproxy,^keepalived,^keystone,^kolla-toolbox,^mariadb,^memcached,^rabbitmq,^venus"
+ fi
+
sudo tee -a /etc/kolla/kolla-build.conf <<EOF
[profiles]
gate = ${GATE_IMAGES}
diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2
index a8b0d3d76..22dda70c7 100644
--- a/tests/templates/globals-default.j2
+++ b/tests/templates/globals-default.j2
@@ -191,3 +191,8 @@ octavia_amp_flavor:
octavia_network_type: "tenant"
{% endif %}
+{% if scenario == "venus" %}
+enable_elasticsearch: "yes"
+enable_keystone: "yes"
+enable_venus: "yes"
+{% endif %}
diff --git a/tests/test-venus.sh b/tests/test-venus.sh
new file mode 100755
index 000000000..4bb4a4c8f
--- /dev/null
+++ b/tests/test-venus.sh
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+set -o xtrace
+set -o errexit
+set -o pipefail
+
+# Enable unbuffered output
+export PYTHONUNBUFFERED=1
+
+# TODO(yoctozepto): Avoid duplicating this from prometheus-efk
+function check_elasticsearch {
+ # Verify that we see a healthy index created due to Fluentd forwarding logs
+ local es_url=${OS_AUTH_URL%:*}:9200/_cluster/health
+ output_path=$1
+ args=(
+ --include
+ --location
+ --fail
+ )
+ if ! curl "${args[@]}" $es_url > $output_path; then
+ return 1
+ fi
+ # NOTE(mgoddard): Status may be yellow because no indices have been
+ # created.
+ if ! grep -E '"status":"(green|yellow)"' $output_path >/dev/null; then
+ return 1
+ fi
+}
+
+function check_venus {
+ local venus_url=${OS_AUTH_URL%:*}:10010/custom_config
+ output_path=$1
+ if ! curl --include --fail $venus_url > $output_path; then
+ return 1
+ fi
+ if ! grep -E '"status": "SUPPORTED"' $output_path >/dev/null; then
+ return 1
+ fi
+}
+
+function test_elasticsearch {
+ echo "TESTING: Elasticsearch"
+ output_path=$(mktemp)
+ attempt=1
+ while ! check_elasticsearch $output_path; do
+ echo "Elasticsearch not accessible yet"
+ attempt=$((attempt+1))
+ if [[ $attempt -eq 12 ]]; then
+ echo "FAILED: Elasticsearch did not become accessible. Response:"
+ cat $output_path
+ return 1
+ fi
+ sleep 10
+ done
+ echo "SUCCESS: Elasticsearch"
+}
+
+function test_venus {
+ echo "TESTING: Venus"
+ output_path=$(mktemp)
+ attempt=1
+ while ! check_venus $output_path; do
+ echo "Venus not accessible yet"
+ attempt=$((attempt+1))
+ if [[ $attempt -eq 12 ]]; then
+ echo "FAILED: Venus did not become accessible. Response:"
+ cat $output_path
+ return 1
+ fi
+ sleep 10
+ done
+ echo "SUCCESS: Venus"
+}
+
+function test_venus_scenario_logged {
+ . /etc/kolla/admin-openrc.sh
+
+ test_elasticsearch
+ test_venus
+}
+
+function test_venus_scenario {
+ echo "Testing Venus and EFK"
+ test_venus_scenario_logged > /tmp/logs/ansible/test-venus-scenario 2>&1
+ result=$?
+ if [[ $result != 0 ]]; then
+ echo "Testing Venus scenario failed. See ansible/test-venus-scenario for details"
+ else
+ echo "Successfully tested Venus scenario. See ansible/test-venus-scenario for details"
+ fi
+ return $result
+}
+
+test_venus_scenario