aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorUwe Jäger <uwe.jaeger@valiton.com>2024-01-17 13:58:36 +0100
committerUwe Jäger <uwe.jaeger@valiton.com>2024-03-15 20:18:29 +0100
commita4e6e58e4ed3293312fd8732b2c5fdef145abd58 (patch)
tree32dcc96517eea32d6a7b07cb1f9b4dd971d6cf3d /tests
parent21543fefb94e7a58e008c4c5c98b09609ba64729 (diff)
downloadkolla-ansible-a4e6e58e4ed3293312fd8732b2c5fdef145abd58.tar.gz
kolla-ansible-a4e6e58e4ed3293312fd8732b2c5fdef145abd58.zip
Update Skyline configuration to enable SSO
Change-Id: I5b4a30e605bb143cf342f83f0c811c25046269ef
Diffstat (limited to 'tests')
-rw-r--r--tests/run.yml7
-rw-r--r--tests/templates/globals-default.j25
-rw-r--r--tests/test-skyline-sso.sh59
-rw-r--r--tests/test-skyline.sh34
4 files changed, 104 insertions, 1 deletions
diff --git a/tests/run.yml b/tests/run.yml
index 9723d2b72..4fd33e6bc 100644
--- a/tests/run.yml
+++ b/tests/run.yml
@@ -577,6 +577,13 @@
chdir: "{{ kolla_ansible_src_dir }}"
when: scenario == "skyline"
+ - name: Run test-skyline-sso.sh script
+ script:
+ cmd: test-skyline-sso.sh
+ executable: /bin/bash
+ chdir: "{{ kolla_ansible_src_dir }}"
+ when: scenario == "skyline-sso"
+
when: scenario != "bifrost"
# NOTE(yoctozepto): each host checks itself
diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2
index 1c1101408..e154d8855 100644
--- a/tests/templates/globals-default.j2
+++ b/tests/templates/globals-default.j2
@@ -266,6 +266,11 @@ kolla_admin_openrc_cacert: "{% raw %}{{ kolla_certificates_dir }}{% endraw %}/ca
enable_skyline: "yes"
{% endif %}
+{% if scenario == "skyline-sso" %}
+enable_skyline: "yes"
+skyline_enable_sso: "yes"
+{% endif %}
+
{# Workaround for https://github.com/rabbitmq/rabbitmq-server/issues/10728 #}
{% if address_family == 'ipv6' %}
{% raw %}
diff --git a/tests/test-skyline-sso.sh b/tests/test-skyline-sso.sh
new file mode 100644
index 000000000..c2b06f213
--- /dev/null
+++ b/tests/test-skyline-sso.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+set -o xtrace
+set -o pipefail
+
+# Enable unbuffered output
+export PYTHONUNBUFFERED=1
+
+function check_skyline_sso_enabled {
+ skyline_endpoint=$(openstack endpoint list --interface public --service skyline -f value -c URL)
+ # 9998 is the default port for skyline apiserver.
+ # 9999 is the default port for skyline console.
+ skyline_sso_url="${skyline_endpoint//9998/9999}/api/openstack/skyline/api/v1/sso"
+
+ output_path=$1
+ if ! curl -k --include --fail $skyline_sso_url -H "Accept: application/json" -H "Content-Type: application/json" > $output_path; then
+ return 1
+ fi
+ if ! grep -E '"enable_sso":true' $output_path >/dev/null; then
+ return 1
+ fi
+}
+
+function test_skyline_sso {
+ . /etc/kolla/admin-openrc.sh
+ . ~/openstackclient-venv/bin/activate
+ test_skyline_sso_enabled
+}
+
+function test_skyline_sso_enabled {
+ echo "TESTING: Skyline SSO enabled"
+ output_path=$(mktemp)
+ attempt=1
+ while ! check_skyline_sso_enabled $output_path; do
+ echo "Skyline not accessible yet"
+ attempt=$((attempt+1))
+ if [[ $attempt -eq 12 ]]; then
+ echo "FAILED: Skyline did not become accessible or SSO not enabled. Response:"
+ cat $output_path
+ return 1
+ fi
+ sleep 10
+ done
+ echo "SUCCESS: Skyline SSO enabled"
+}
+
+function test_skyline_sso_scenario {
+ echo "Testing Skyline SSO"
+ test_skyline_sso > /tmp/logs/ansible/test-skyline-sso 2>&1
+ result=$?
+ if [[ $result != 0 ]]; then
+ echo "Testing Skyline SSO failed. See ansible/test-skyline-sso for details"
+ else
+ echo "Successfully tested Skyline SSO. See ansible/test-skyline-sso for details"
+ fi
+ return $result
+}
+
+test_skyline_sso_scenario
diff --git a/tests/test-skyline.sh b/tests/test-skyline.sh
index 5b276392e..6216799d1 100644
--- a/tests/test-skyline.sh
+++ b/tests/test-skyline.sh
@@ -22,6 +22,21 @@ function check_skyline {
fi
}
+function check_skyline_sso_disabled {
+ skyline_endpoint=$(openstack endpoint list --interface public --service skyline -f value -c URL)
+ # 9998 is the default port for skyline apiserver.
+ # 9999 is the default port for skyline console.
+ skyline_sso_url="${skyline_endpoint//9998/9999}/api/openstack/skyline/api/v1/sso"
+
+ output_path=$1
+ if ! curl -k --include --fail $skyline_sso_url -H "Accept: application/json" -H "Content-Type: application/json" > $output_path; then
+ return 1
+ fi
+ if ! grep -E '"enable_sso":false' $output_path >/dev/null; then
+ return 1
+ fi
+}
+
function test_skyline {
echo "TESTING: Skyline"
output_path=$(mktemp)
@@ -45,9 +60,26 @@ function test_skyline_logged {
test_skyline
}
+function test_skyline_sso_disabled {
+ echo "TESTING: Skyline SSO disabled"
+ output_path=$(mktemp)
+ attempt=1
+ while ! check_skyline_sso_disabled $output_path; do
+ echo "Skyline not accessible yet"
+ attempt=$((attempt+1))
+ if [[ $attempt -eq 12 ]]; then
+ echo "FAILED: Skyline did not become accessible or SSO enabled. Response:"
+ cat $output_path
+ return 1
+ fi
+ sleep 10
+ done
+ echo "SUCCESS: Skyline SSO disabled"
+}
+
function test_skyline_scenario {
echo "Testing Skyline"
- test_skyline_logged > /tmp/logs/ansible/test-skyline 2>&1
+ test_skyline_logged > /tmp/logs/ansible/test-skyline 2>&1 && test_skyline_sso_disabled >> /tmp/logs/ansible/test-skyline 2>&1
result=$?
if [[ $result != 0 ]]; then
echo "Testing Skyline failed. See ansible/test-skyline for details"