diff --git a/tests/run.yml b/tests/run.yml index 3c49bfbca8..c1f5a13e6d 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -27,7 +27,7 @@ - name: Prepare disks for Ceph or LVM script: "setup_disks.sh {{ disk_type }}" - when: scenario in ['cinder-lvm', 'ceph'] + when: scenario in ['cinder-lvm', 'ceph', 'zun'] become: true vars: disk_type: "{{ ceph_storetype if scenario == 'ceph' else 'cinder-lvm' }}" diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2 index 00a57949de..f1358d32ed 100644 --- a/tests/templates/globals-default.j2 +++ b/tests/templates/globals-default.j2 @@ -88,6 +88,10 @@ enable_zun: "yes" enable_kuryr: "yes" enable_etcd: "yes" docker_configure_for_zun: "yes" +enable_cinder: "yes" +# lvm backup driver for cinder-backup does not exist +enable_cinder_backup: "no" +enable_cinder_backend_lvm: "yes" {% endif %} {% if scenario == "scenario_nfv" %} diff --git a/tests/test-zun.sh b/tests/test-zun.sh index 1c5d6b34d7..155f667a49 100755 --- a/tests/test-zun.sh +++ b/tests/test-zun.sh @@ -47,6 +47,57 @@ function test_zun_logged { done echo "SUCCESS: Zun" + + echo "TESTING: Zun Cinder volume attachment" + openstack volume create --size 2 zun_test_volume + attempt=1 + while [[ $(openstack volume show zun_test_volume -f value -c status) != "available" ]]; do + echo "Volume not available yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 10 ]]; then + echo "Volume failed to become available" + openstack volume show zun_test_volume + return 1 + fi + sleep 10 + done + openstack appcontainer run --name test2 --mount source=zun_test_volume,destination=/data alpine sleep 1000 + attempt=1 + while [[ $(openstack volume show zun_test_volume -f value -c status) != "in-use" ]]; do + echo "Volume not attached yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 10 ]]; then + echo "Volume failed to attach" + openstack volume show zun_test_volume + return 1 + fi + sleep 10 + done + attempt=1 + while [[ $(openstack appcontainer show test2 -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 test2 + return 1 + fi + sleep 10 + done + openstack appcontainer delete --stop test2 + attempt=1 + while [[ $(openstack volume show zun_test_volume -f value -c status) != "available" ]]; do + echo "Volume not detached yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 10 ]]; then + echo "Volume failed to detach" + openstack volume show zun_test_volume + return 1 + fi + sleep 10 + done + openstack volume delete zun_test_volume + echo "SUCCESS: Zun Cinder volume attachment" } function test_zun { diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh index 1e432b050f..02329cfb9e 100755 --- a/tools/setup_gate.sh +++ b/tools/setup_gate.sh @@ -41,7 +41,7 @@ function setup_config { fi if [[ $SCENARIO == "zun" ]]; then - GATE_IMAGES+=",zun,kuryr,etcd" + GATE_IMAGES+=",zun,kuryr,etcd,cinder,iscsid,tgtd" fi if [[ $SCENARIO == "scenario_nfv" ]]; then