Testing Masakari role in gate

Add Masakari testing into the Gate.

Change-Id: I52df33f963e7d2ae4059887df3d24d9e6642134e
Depends-On: https://review.opendev.org/#/c/615469/
Depends-On: https://review.opendev.org/#/c/615715
Implements: blueprint ansible-masakari
Co-Authored-By: Gaëtan Trellu <gaetan.trellu@incloudus.com>
This commit is contained in:
Kien Nguyen 2018-11-07 09:09:04 +07:00 committed by Gaëtan Trellu
parent b599f78dd7
commit fbac54c5f5
7 changed files with 119 additions and 0 deletions

View File

@ -222,6 +222,13 @@
chdir: "{{ kolla_ansible_src_dir }}" chdir: "{{ kolla_ansible_src_dir }}"
when: scenario == "ironic" when: scenario == "ironic"
- name: Run test-masakari.sh script
script:
cmd: test-masakari.sh
executable: /bin/bash
chdir: "{{ kolla_ansible_src_dir }}"
when: scenario == "masakari"
- name: Run reconfigure.sh script - name: Run reconfigure.sh script
script: script:
cmd: reconfigure.sh cmd: reconfigure.sh

View File

@ -83,3 +83,7 @@ enable_barbican: "yes"
enable_ironic: "yes" enable_ironic: "yes"
ironic_dnsmasq_dhcp_range: "10.42.0.2,10.42.0.254" ironic_dnsmasq_dhcp_range: "10.42.0.2,10.42.0.254"
{% endif %} {% endif %}
{% if scenario == "masakari" %}
enable_masakari: "yes"
{% endif %}

View File

@ -381,6 +381,16 @@ network
[manila-data:children] [manila-data:children]
manila manila
# Masakari
[masakari-api:children]
control
[masakari-engine:children]
control
[masakari-monitors:children]
compute
# Swift # Swift
[swift-proxy-server:children] [swift-proxy-server:children]
swift swift

62
tests/test-masakari.sh Executable file
View File

@ -0,0 +1,62 @@
#!/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
# NOTE:(gtrellu) Masakari client/API has a bug which generate a mismatch
# between what the client send and what the API should received.
CLIENT_OPTS="--os-ha-api-version 1.0"
# 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 $CLIENT_OPTS segment create test_segment auto COMPUTE; then
echo "Unable to create Masakari segment"
return 1
fi
# Add Nova compute to Masakari segment
if ! openstack $CLIENT_OPTS 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 $CLIENT_OPTS 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

View File

@ -19,6 +19,9 @@ function setup_openstack_clients {
if [[ $ACTION == ironic ]]; then if [[ $ACTION == ironic ]]; then
~/openstackclient-venv/bin/pip install python-ironicclient ~/openstackclient-venv/bin/pip install python-ironicclient
fi fi
if [[ $ACTION == masakari ]]; then
~/openstackclient-venv/bin/pip install python-masakariclient
fi
} }
function setup_config { function setup_config {
@ -58,6 +61,9 @@ EOF
if [[ $ACTION == "ironic" ]]; then if [[ $ACTION == "ironic" ]]; then
GATE_IMAGES+=",dnsmasq,ironic,iscsid" GATE_IMAGES+=",dnsmasq,ironic,iscsid"
fi fi
if [[ $ACTION == "masakari" ]]; then
GATE_IMAGES+=",masakari"
fi
cat <<EOF | sudo tee /etc/kolla/kolla-build.conf cat <<EOF | sudo tee /etc/kolla/kolla-build.conf
[DEFAULT] [DEFAULT]

View File

@ -203,3 +203,23 @@
vars: vars:
base_distro: ubuntu base_distro: ubuntu
install_type: binary install_type: binary
- job:
name: kolla-ansible-ubuntu-source-masakari
parent: kolla-ansible-base
nodeset: kolla-ansible-bionic
voting: false
vars:
base_distro: ubuntu
install_type: source
scenario: masakari
- job:
name: kolla-ansible-centos-source-masakari
parent: kolla-ansible-base
nodeset: kolla-ansible-centos
voting: false
vars:
base_distro: centos
install_type: source
scenario: masakari

View File

@ -30,6 +30,14 @@
files: files:
- ^ansible/roles/(barbican|heat|mistral|redis|tacker)/ - ^ansible/roles/(barbican|heat|mistral|redis|tacker)/
- ^tests/test-scenario-nfv.sh - ^tests/test-scenario-nfv.sh
- kolla-ansible-ubuntu-source-masakari:
files:
- ^ansible/roles/masakari/
- ^tests/test-masakari.sh
- kolla-ansible-centos-source-masakari:
files:
- ^ansible/roles/masakari/
- ^tests/test-masakari.sh
- kolla-ansible-centos-source-ironic - kolla-ansible-centos-source-ironic
- kolla-ansible-centos-binary-ironic - kolla-ansible-centos-binary-ironic
- kolla-ansible-ubuntu-source-ironic - kolla-ansible-ubuntu-source-ironic
@ -50,6 +58,8 @@
jobs: jobs:
- kolla-ansible-bifrost-centos-source - kolla-ansible-bifrost-centos-source
- kolla-ansible-ubuntu-source-zun - kolla-ansible-ubuntu-source-zun
- kolla-ansible-ubuntu-source-masakari
- kolla-ansible-centos-source-masakari
- kolla-ansible-centos-source-scenario-nfv - kolla-ansible-centos-source-scenario-nfv
- kolla-ansible-ubuntu-source-cinder-lvm - kolla-ansible-ubuntu-source-cinder-lvm
- kolla-ansible-centos-source-cinder-lvm - kolla-ansible-centos-source-cinder-lvm