kolla-ansible/tests/test-masakari.sh
Radosław Piliszek c0ba63adad [CI] Drop the workaround in Masakari client calls
Now that the issue is fixed upstream, let's remove the workaround.

[1] If3943060b5d09bd153b6401d34c7d10d3dc864fe

Change-Id: I9cbeee5a397d736338ff2065001d9d6be20cb66e
2021-03-24 15:51:22 +00:00

58 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -o xtrace
set -o errexit
set -o pipefail
# Enable unbuffered output for Ansible in Jenkins.
export PYTHONUNBUFFERED=1
function test_masakari_logged {
# Source OpenStack credentials
. /etc/kolla/admin-openrc.sh
# Activate virtualenv to access Masakari client
. ~/openstackclient-venv/bin/activate
# Get the first Nova compute
if ! HYPERVISOR=$(openstack hypervisor list -f value -c 'Hypervisor Hostname' | head -n1); then
echo "Unable to get Nova hypervisor list"
return 1
fi
# Create Masakari segment
if ! openstack segment create test_segment auto COMPUTE; then
echo "Unable to create Masakari segment"
return 1
fi
# Add Nova compute to Masakari segment
if ! openstack segment host create $HYPERVISOR COMPUTE SSH test_segment; then
echo "Unable to add Nova hypervisor to Masakari segment"
return 1
fi
# Delete Masakari segment
if ! openstack segment delete test_segment; then
echo "Unable to delete Masakari segment"
return 1
fi
# Exit virtualenv
deactivate
}
function test_masakari {
echo "Testing Masakari"
test_masakari_logged > /tmp/logs/ansible/test-masakari 2>&1
result=$?
if [[ $result != 0 ]]; then
echo "Testing Masakari failed. See ansible/test-masakari for details"
else
echo "Successfully tested Masakari. See ansible/test-masakari for details"
fi
return $result
}
test_masakari