CI: Zun jobs

- Test Zun on CentOS too
- Make etcd change also trigger Zun jobs (like kuryr and zun)
- Test multinode Zun deployments instead of AIO
  (more likely to break)
- In Zun scenario, stop configuring docker for legacy swarm mode
  (Zun is no swarm)
- Separate test-zun.sh testing script
- Show appcontainer to see which node it has been started on

Change-Id: I289b1009fe00aedb9b78cbd83298b14da5fd9670
Depends-On: https://review.opendev.org/676736
Signed-off-by: Radosław Piliszek <radoslaw.piliszek@gmail.com>
This commit is contained in:
Radosław Piliszek 2019-08-14 13:14:31 +02:00
parent de2f7be981
commit d4de1d7520
7 changed files with 90 additions and 33 deletions

View File

@ -208,6 +208,13 @@
ACTION: "{{ scenario }}" ACTION: "{{ scenario }}"
when: scenario not in ['ironic', 'scenario_nfv'] when: scenario not in ['ironic', 'scenario_nfv']
- name: Run test-zun.sh script
shell:
cmd: tests/test-zun.sh
executable: /bin/bash
chdir: "{{ kolla_ansible_src_dir }}"
when: "{{ 'zun' in scenario }}"
- name: Run test-scenario-nfv.sh script - name: Run test-scenario-nfv.sh script
script: script:
cmd: test-scenario-nfv.sh cmd: test-scenario-nfv.sh
@ -338,6 +345,13 @@
chdir: "{{ kolla_ansible_src_dir }}" chdir: "{{ kolla_ansible_src_dir }}"
environment: environment:
ACTION: "{{ scenario }}" ACTION: "{{ scenario }}"
- name: Run test-zun.sh script
shell:
cmd: tests/test-zun.sh
executable: /bin/bash
chdir: "{{ kolla_ansible_src_dir }}"
when: "{{ 'zun' in scenario }}"
when: is_upgrade when: is_upgrade
# Bifrost testing. # Bifrost testing.

View File

@ -68,7 +68,7 @@ enable_cinder_backend_lvm: "yes"
enable_zun: "yes" enable_zun: "yes"
enable_kuryr: "yes" enable_kuryr: "yes"
enable_etcd: "yes" enable_etcd: "yes"
docker_custom_option: " -H unix:///var/run/docker.sock -H tcp://{{ api_interface_address }}:2375 --cluster-store=etcd://{{ api_interface_address }}:2379 --cluster-advertise={{ api_interface_address }}:2375" docker_configure_for_zun: "yes"
{% endif %} {% endif %}
{% if scenario == "scenario_nfv" %} {% if scenario == "scenario_nfv" %}

View File

@ -69,30 +69,6 @@ function test_openstack_logged {
echo "TESTING: Server deletion" echo "TESTING: Server deletion"
openstack server delete --wait kolla_boot_test openstack server delete --wait kolla_boot_test
echo "SUCCESS: Server deletion" echo "SUCCESS: Server deletion"
if echo $ACTION | grep -q "zun"; then
echo "TESTING: Zun"
openstack appcontainer service list
openstack appcontainer host list
openstack subnet set --no-dhcp demo-subnet
sudo docker pull alpine
sudo docker save alpine | openstack image create alpine --public --container-format docker --disk-format raw
openstack appcontainer run --name test alpine sleep 1000
attempt=1
while [[ $(openstack appcontainer show test -f value -c status) != "Running" ]]; do
echo "Container not running yet"
attempt=$((attempt+1))
if [[ $attempt -eq 10 ]]; then
echo "Container failed to start"
openstack appcontainer show test
return 1
fi
sleep 10
done
openstack appcontainer list
openstack appcontainer delete --force --stop test
echo "SUCCESS: Zun"
fi
} }
function test_openstack { function test_openstack {

52
tests/test-zun.sh Executable file
View File

@ -0,0 +1,52 @@
#!/bin/bash
set -o xtrace
set -o errexit
export PYTHONUNBUFFERED=1
function test_zun_logged {
. /etc/kolla/admin-openrc.sh
. ~/openstackclient-venv/bin/activate
echo "TESTING: Zun"
openstack appcontainer service list
openstack appcontainer host list
openstack subnet set --no-dhcp demo-subnet
sudo docker pull alpine
sudo docker save alpine | openstack image create alpine --public --container-format docker --disk-format raw
openstack appcontainer run --name test alpine sleep 1000
attempt=1
while [[ $(openstack appcontainer show test -f value -c status) != "Running" ]]; do
echo "Container not running yet"
attempt=$((attempt+1))
if [[ $attempt -eq 10 ]]; then
echo "Container failed to start"
openstack appcontainer show test
return 1
fi
sleep 10
done
openstack appcontainer list
openstack appcontainer show test
openstack appcontainer delete --force --stop test
echo "SUCCESS: Zun"
}
function test_zun {
echo "Testing Zun"
log_file=/tmp/logs/ansible/test-zun
if [[ -f $log_file ]]; then
log_file=${log_file}-upgrade
fi
test_zun_logged > $log_file 2>&1
result=$?
if [[ $result != 0 ]]; then
echo "Testing Zun failed. See ansible/test-zun for details"
else
echo "Successfully tested Zun. See ansible/test-zun for details"
fi
return $result
}
test_zun

View File

@ -48,3 +48,13 @@
- ^tests/test-ironic.sh - ^tests/test-ironic.sh
vars: vars:
scenario: ironic scenario: ironic
- job:
name: kolla-ansible-zun-base
parent: kolla-ansible-base
voting: false
files:
- ^ansible/roles/(zun|kuryr|etcd)/
- ^tests/test-zun.sh
vars:
scenario: zun

View File

@ -149,15 +149,21 @@
vars: vars:
base_distro: centos base_distro: centos
- job:
name: kolla-ansible-centos-source-zun
parent: kolla-ansible-zun-base
nodeset: kolla-ansible-centos-multi
vars:
base_distro: centos
install_type: source
- job: - job:
name: kolla-ansible-ubuntu-source-zun name: kolla-ansible-ubuntu-source-zun
parent: kolla-ansible-base parent: kolla-ansible-zun-base
nodeset: kolla-ansible-bionic nodeset: kolla-ansible-bionic-multi
voting: false
vars: vars:
base_distro: ubuntu base_distro: ubuntu
install_type: source install_type: source
scenario: zun
- job: - job:
name: kolla-ansible-centos-source-scenario-nfv name: kolla-ansible-centos-source-scenario-nfv

View File

@ -22,10 +22,8 @@
files: ^ansible\/roles\/(cinder|iscsi)\/.* files: ^ansible\/roles\/(cinder|iscsi)\/.*
- kolla-ansible-bifrost-centos-source: - kolla-ansible-bifrost-centos-source:
files: ^ansible\/roles\/bifrost\/.* files: ^ansible\/roles\/bifrost\/.*
- kolla-ansible-ubuntu-source-zun: - kolla-ansible-centos-source-zun
files: - kolla-ansible-ubuntu-source-zun
- ^ansible/roles/(zun|kuryr)/
- ^tests/test-openstack.sh
- kolla-ansible-centos-source-scenario-nfv: - kolla-ansible-centos-source-scenario-nfv:
files: files:
- ^ansible/roles/(barbican|heat|mistral|redis|tacker)/ - ^ansible/roles/(barbican|heat|mistral|redis|tacker)/
@ -57,6 +55,7 @@
periodic: periodic:
jobs: jobs:
- kolla-ansible-bifrost-centos-source - kolla-ansible-bifrost-centos-source
- kolla-ansible-centos-source-zun
- kolla-ansible-ubuntu-source-zun - kolla-ansible-ubuntu-source-zun
- kolla-ansible-ubuntu-source-masakari - kolla-ansible-ubuntu-source-masakari
- kolla-ansible-centos-source-masakari - kolla-ansible-centos-source-masakari