From 362b6ee40e27bcb65289d4d1e0273638d69299ba Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Date: Mon, 12 Nov 2018 15:09:31 +0100 Subject: [PATCH] Test zun container creation in gates Change-Id: If5b4ba975a65e07d2704eb6bdb9d841d6a9c3d42 --- ansible/roles/zun/defaults/main.yml | 1 + tests/get_logs.sh | 2 +- tests/templates/globals-default.j2 | 3 ++- tests/test-openstack.sh | 23 +++++++++++++++++++---- tools/setup_gate.sh | 2 +- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ansible/roles/zun/defaults/main.yml b/ansible/roles/zun/defaults/main.yml index 5220370924..a8c2991eac 100644 --- a/ansible/roles/zun/defaults/main.yml +++ b/ansible/roles/zun/defaults/main.yml @@ -59,6 +59,7 @@ zun_services: - "{{ kolla_dev_repos_directory ~ '/zun/zun:/var/lib/kolla/venv/lib/python2.7/site-packages/zun' if zun_dev_mode | bool else '' }}" - "/run:/run:shared" - "/usr/lib/docker:/usr/lib/docker" + - "/var/lib/docker:/var/lib/docker" dimensions: "{{ zun_compute_dimensions }}" #################### diff --git a/tests/get_logs.sh b/tests/get_logs.sh index 0947846046..bce497794b 100644 --- a/tests/get_logs.sh +++ b/tests/get_logs.sh @@ -37,7 +37,7 @@ copy_logs() { ps -eo user,pid,ppid,lwp,%cpu,%mem,size,rss,cmd > ${LOG_DIR}/system_logs/ps.txt # docker related information - (docker info && docker images && docker ps -a) > ${LOG_DIR}/system_logs/docker-info.txt + (docker info && docker images && docker ps -a && docker network ls) > ${LOG_DIR}/system_logs/docker-info.txt # ceph related logs if [[ $(docker ps --filter name=ceph_mon --format "{{.Names}}") ]]; then diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2 index 3381fb5a03..bb4392c497 100644 --- a/tests/templates/globals-default.j2 +++ b/tests/templates/globals-default.j2 @@ -39,5 +39,6 @@ glance_enable_rolling_upgrade: "yes" {% if scenario == "zun" %} enable_zun: "yes" enable_kuryr: "yes" -docker_custom_option: " -H unix:///var/run/docker.sock -H tcp://{{ api_interface_address }}:2375" +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" {% endif %} diff --git a/tests/test-openstack.sh b/tests/test-openstack.sh index 78502f620d..d7337822a5 100755 --- a/tests/test-openstack.sh +++ b/tests/test-openstack.sh @@ -48,10 +48,25 @@ function test_openstack_logged { if echo $ACTION | grep -q "zun"; then echo "TESTING: Zun" - openstack --debug appcontainer service list - openstack --debug appcontainer host list - # TODO(hongbin): Run a Zun container and assert the container becomes - # Running + 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 } diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh index 455212e977..922a72109d 100755 --- a/tools/setup_gate.sh +++ b/tools/setup_gate.sh @@ -45,7 +45,7 @@ EOF fi if [[ $ACTION == "zun" ]]; then - GATE_IMAGES+=",zun,kuryr" + GATE_IMAGES+=",zun,kuryr,etcd" fi cat <