From d2326712d41e2a526dc7fef328f4b7dba7f58246 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 12 Apr 2019 11:19:39 +0100 Subject: [PATCH] CI: add magnum scenario, also covering octavia Adds a new Zuul job, kolla-ansible-centos8-source-magnum, for testing deployment of Magnum, Octavia and associated services. Change-Id: I61b293ba6bb52064ea98a73e2dff0023fa01a2a2 --- tests/run.yml | 25 +++++++++++++++++++ tests/setup_gate.sh | 6 +++++ tests/templates/globals-default.j2 | 5 ++++ tests/test-magnum.sh | 40 ++++++++++++++++++++++++++++++ zuul.d/base.yaml | 11 ++++++++ zuul.d/jobs.yaml | 16 ++++++++++++ zuul.d/project.yaml | 2 ++ 7 files changed, 105 insertions(+) create mode 100755 tests/test-magnum.sh diff --git a/tests/run.yml b/tests/run.yml index de2ca429fe..adee4326cc 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -166,6 +166,24 @@ dest: ironic-agent.kernel when: scenario == "ironic" + - block: + - name: ensure octavia config directory exists + file: + path: /etc/kolla/config/octavia + state: directory + mode: 0777 + + - name: create dummy TLS certificates for octavia + file: + path: "/etc/kolla/config/octavia/{{ item }}" + state: touch + with_items: + - client.cert-and-key.pem + - client_ca.cert.pem + - server_ca.cert.pem + - server_ca.key.pem + when: scenario == 'magnum' + - name: ensure /etc/ansible exists file: path: /etc/ansible @@ -385,6 +403,13 @@ chdir: "{{ kolla_ansible_src_dir }}" when: scenario == "ironic" + - name: Run test-magnum.sh script + script: + cmd: test-magnum.sh + executable: /bin/bash + chdir: "{{ kolla_ansible_src_dir }}" + when: scenario == "magnum" + - name: Run test-masakari.sh script script: cmd: test-masakari.sh diff --git a/tests/setup_gate.sh b/tests/setup_gate.sh index e5a77388fc..3b1fc78e7c 100755 --- a/tests/setup_gate.sh +++ b/tests/setup_gate.sh @@ -17,6 +17,9 @@ function setup_openstack_clients { if [[ $SCENARIO == ironic ]]; then packages+=(python-ironicclient python-ironic-inspector-client) fi + if [[ $SCENARIO == magnum ]]; then + packages+=(python-magnumclient python-octaviaclient) + fi if [[ $SCENARIO == masakari ]]; then packages+=(python-masakariclient) fi @@ -59,6 +62,9 @@ function prepare_images { if [[ $SCENARIO == "ironic" ]]; then GATE_IMAGES+=",^dnsmasq,^ironic,^iscsid" fi + if [[ $SCENARIO == "magnum" ]]; then + GATE_IMAGES+=",^magnum,^octavia" + fi if [[ $SCENARIO == "masakari" ]]; then GATE_IMAGES+=",^masakari" fi diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2 index a7641fdf00..2740ab1ef5 100644 --- a/tests/templates/globals-default.j2 +++ b/tests/templates/globals-default.j2 @@ -151,3 +151,8 @@ enable_grafana: "yes" enable_prometheus: "yes" enable_prometheus_openstack_exporter: "no" {% endif %} + +{% if scenario == "magnum" %} +enable_magnum: "yes" +enable_octavia: "yes" +{% endif %} diff --git a/tests/test-magnum.sh b/tests/test-magnum.sh new file mode 100755 index 0000000000..9519fba257 --- /dev/null +++ b/tests/test-magnum.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Test deployment of magnum and octavia. + +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_magnum_logged { + . /etc/kolla/admin-openrc.sh + . ~/openstackclient-venv/bin/activate + test_magnum_clusters + test_octavia +} + +function test_magnum { + echo "Testing Magnum and Octavia" + test_magnum_logged > /tmp/logs/ansible/test-magnum 2>&1 + result=$? + if [[ $result != 0 ]]; then + echo "Testing Magnum and Octavia failed. See ansible/test-magnum for details" + else + echo "Successfully tested Magnum and Octavia. See ansible/test-magnum for details" + fi + return $result +} + +test_magnum diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml index e2403b2cac..2a5eb7c42f 100644 --- a/zuul.d/base.yaml +++ b/zuul.d/base.yaml @@ -124,6 +124,17 @@ - name: github.com/ceph/ceph-ansible override-checkout: v5.0.0 +- job: + name: kolla-ansible-magnum-base + parent: kolla-ansible-base + voting: false + files: + - ^ansible/roles/(magnum|octavia)/ + - ^tests/test-dashboard.sh + - ^tests/test-magnum.sh + vars: + scenario: magnum + - job: name: kolla-ansible-masakari-base parent: kolla-ansible-base diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 27702f48f7..edcea29696 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -249,6 +249,22 @@ base_distro: ubuntu install_type: binary +- job: + name: kolla-ansible-centos8-source-magnum + parent: kolla-ansible-magnum-base + nodeset: kolla-ansible-centos8 + vars: + base_distro: centos + install_type: source + +- job: + name: kolla-ansible-ubuntu-source-magnum + parent: kolla-ansible-magnum-base + nodeset: kolla-ansible-focal + vars: + base_distro: ubuntu + install_type: source + - job: name: kolla-ansible-ubuntu-source-masakari parent: kolla-ansible-masakari-base diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index eca2e15323..3a56e55d82 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -23,6 +23,8 @@ - kolla-ansible-centos8-source-swift - kolla-ansible-ubuntu-source-swift - kolla-ansible-centos8-source-scenario-nfv + - kolla-ansible-centos8-source-magnum + - kolla-ansible-ubuntu-source-magnum - kolla-ansible-centos8-source-masakari - kolla-ansible-ubuntu-source-masakari - kolla-ansible-centos8-source-ironic