kolla-ansible/tests/test-magnum.sh
wu.chunyang be7d640c05 [CI] Add trove smoke test CI
Add trove smoke test.

Change-Id: I571d9663bcadb1ddc5a7ad86a2c478706e0705a9
2020-11-19 18:11:40 +08:00

87 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Test deployment of magnum, octavia and designate.
set -o xtrace
set -o errexit
# Enable unbuffered output for Ansible in Jenkins.
export PYTHONUNBUFFERED=1
function test_magnum_clusters {
openstack coe cluster list
openstack coe cluster template list
}
function test_octavia {
openstack loadbalancer list
}
function test_trove {
# smoke test
openstack database instance list
openstack database cluster list
}
function test_designate {
# Smoke test.
openstack zone list --all
# Create a default zone for fixed and floating IPs, then reconfigure nova
# and neutron to use it.
openstack zone create --email admin@example.org example.org.
ZONE_ID=$(openstack zone show example.org. -f value -c id)
mkdir -p /etc/kolla/config/designate/
cat << EOF > /etc/kolla/config/designate/designate-sink.conf
[handler:nova_fixed]
zone_id = ${ZONE_ID}
[handler:neutron_floatingip]
zone_id = ${ZONE_ID}
EOF
RAW_INVENTORY=/etc/kolla/inventory
kolla-ansible -i ${RAW_INVENTORY} --tags designate -vvv reconfigure &> /tmp/logs/ansible/reconfigure-designate
# Create an instance, and check that its name resolves.
openstack server create --wait --image cirros --flavor m1.tiny --key-name mykey --network demo-net dns-test --wait
attempt=1
while true; do
IP=$(dig +short @192.0.2.1 dns-test.example.org. A)
if [[ -n $IP ]]; then
break
fi
attempt=$((attempt+1))
if [[ $attempt -eq 10 ]]; then
echo "Failed to resolve dns-test.example.org."
openstack recordset list ${ZONE_ID}
exit 1
fi
sleep 10
done
}
function test_magnum_logged {
. /etc/kolla/admin-openrc.sh
. ~/openstackclient-venv/bin/activate
test_magnum_clusters
test_octavia
test_designate
test_trove
}
function test_magnum {
echo "Testing Magnum, Octavia, Trove and Designate"
test_magnum_logged > /tmp/logs/ansible/test-magnum 2>&1
result=$?
if [[ $result != 0 ]]; then
echo "Testing Magnum, Octavia, Trove and Designate failed. See ansible/test-magnum for details"
else
echo "Successfully tested Magnum, Octavia, Trove and Designate . See ansible/test-magnum for details"
fi
return $result
}
test_magnum