diff options
| author | Boxiang Zhu <zhu.boxiang@99cloud.net> | 2022-10-18 10:41:30 +0800 |
|---|---|---|
| committer | Boxiang Zhu <zhu.boxiang@99cloud.net> | 2023-11-08 09:28:53 +0800 |
| commit | 69d979c048d5ec92084414d698e3571d7a4b4920 (patch) | |
| tree | 454372d92a659244bb8d7079b9e8ad9099d38bce /tests/test-skyline.sh | |
| parent | 37c2ab2aaafa06b40ba1c32a29699fbd8ee17b87 (diff) | |
| download | kolla-ansible-69d979c048d5ec92084414d698e3571d7a4b4920.tar.gz kolla-ansible-69d979c048d5ec92084414d698e3571d7a4b4920.zip | |
[CI] Add skyline scenario
Skyline is a new service for dashboard.
This patch adds a CI scenario which tests Skyline deployment.
Depends-On: https://review.opendev.org/c/openstack/kolla/+/826948
Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/828464
Implements: blueprint skyline
Change-Id: I48488a24d6c8a03cd129929347b1bdac25f198b0
Diffstat (limited to 'tests/test-skyline.sh')
| -rw-r--r-- | tests/test-skyline.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/test-skyline.sh b/tests/test-skyline.sh new file mode 100644 index 000000000..5b276392e --- /dev/null +++ b/tests/test-skyline.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +set -o xtrace +set -o pipefail + +# Enable unbuffered output +export PYTHONUNBUFFERED=1 + +function check_skyline { + 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_login_url="${skyline_endpoint//9998/9999}/api/openstack/skyline/api/v1/login" + skyline_body="{\"region\": \"${OS_REGION_NAME}\", \"domain\": \"${OS_USER_DOMAIN_NAME}\", \"username\": \"${OS_USERNAME}\", \"password\": \"${OS_PASSWORD}\"}" + + output_path=$1 + if ! curl -k --include --fail -X POST $skyline_login_url -H "Accept: application/json" -H "Content-Type: application/json" -d "${skyline_body}" > $output_path; then + return 1 + fi + if ! grep -E '"keystone_token":' $output_path >/dev/null; then + return 1 + fi +} + +function test_skyline { + echo "TESTING: Skyline" + output_path=$(mktemp) + attempt=1 + while ! check_skyline $output_path; do + echo "Skyline not accessible yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 12 ]]; then + echo "FAILED: Skyline did not become accessible. Response:" + cat $output_path + return 1 + fi + sleep 10 + done + echo "SUCCESS: Skyline" +} + +function test_skyline_logged { + . /etc/kolla/admin-openrc.sh + . ~/openstackclient-venv/bin/activate + test_skyline +} + +function test_skyline_scenario { + echo "Testing Skyline" + test_skyline_logged > /tmp/logs/ansible/test-skyline 2>&1 + result=$? + if [[ $result != 0 ]]; then + echo "Testing Skyline failed. See ansible/test-skyline for details" + else + echo "Successfully tested Skyline. See ansible/test-skyline for details" + fi + return $result +} + +test_skyline_scenario |
