diff options
| author | Zuul <zuul@review.opendev.org> | 2021-03-03 16:47:27 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2021-03-03 16:47:27 +0000 |
| commit | 21b9b5092f1e9edc2dec56663b8d41dd44f8a73d (patch) | |
| tree | 3e79479a3c160dac52dfc28278468c0bb17c912c /tests | |
| parent | 933d575bd5f70e2fdba759622de50d8ae89c51cb (diff) | |
| parent | 62b8c6b68413330da032d14b45c6fbd340ec9e2d (diff) | |
| download | kolla-ansible-21b9b5092f1e9edc2dec56663b8d41dd44f8a73d.tar.gz kolla-ansible-21b9b5092f1e9edc2dec56663b8d41dd44f8a73d.zip | |
Merge "[CI] Cinder upgrade testing"
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.yml | 4 | ||||
| -rwxr-xr-x | tests/test-core-openstack.sh | 137 |
2 files changed, 104 insertions, 37 deletions
diff --git a/tests/run.yml b/tests/run.yml index 380bf8fb7..42dedaed7 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -398,6 +398,8 @@ chdir: "{{ kolla_ansible_src_dir }}" environment: SCENARIO: "{{ scenario }}" + HAS_UPGRADE: "{{ is_upgrade | bool | ternary('yes', 'no') }}" + PHASE: deploy when: openstack_core_tested - name: Run test-zun.sh script @@ -596,6 +598,8 @@ chdir: "{{ kolla_ansible_src_dir }}" environment: SCENARIO: "{{ scenario }}" + HAS_UPGRADE: 'yes' + PHASE: upgrade when: openstack_core_tested when: is_upgrade diff --git a/tests/test-core-openstack.sh b/tests/test-core-openstack.sh index 8339a7d57..9146fecaf 100755 --- a/tests/test-core-openstack.sh +++ b/tests/test-core-openstack.sh @@ -16,6 +16,85 @@ function test_smoke { fi } +function create_a_volume { + local volume_name=$1 + + local attempt + + openstack volume create --size 2 $volume_name + attempt=1 + while [[ $(openstack volume show $volume_name -f value -c status) != "available" ]]; do + echo "Volume $volume_name not available yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 10 ]]; then + echo "Volume $volume_name failed to become available" + openstack volume show $volume_name + return 1 + fi + sleep 10 + done +} + +function attach_and_detach_a_volume { + local volume_name=$1 + local instance_name=$2 + + local attempt + + openstack server add volume $instance_name $volume_name --device /dev/vdb + attempt=1 + while [[ $(openstack volume show $volume_name -f value -c status) != "in-use" ]]; do + echo "Volume $volume_name not attached yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 10 ]]; then + echo "Volume failed to attach" + openstack volume show $volume_name + return 1 + fi + sleep 10 + done + + openstack server remove volume $instance_name $volume_name + attempt=1 + while [[ $(openstack volume show $volume_name -f value -c status) != "available" ]]; do + echo "Volume $volume_name not detached yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 10 ]]; then + echo "Volume failed to detach" + openstack volume show $volume_name + return 1 + fi + sleep 10 + done +} + +function delete_a_volume { + local volume_name=$1 + + local attempt + local result + + openstack volume delete $volume_name + + attempt=1 + # NOTE(yoctozepto): This is executed outside of the `while` clause + # *on purpose*. You see, bash is evil (TM) and will silence any error + # happening in any "condition" clause (such as `if` or `while`) even with + # `errexit` being set. + result=$(openstack volume list --name $volume_name -f value -c ID) + while [[ -n "$result" ]]; do + echo "Volume $volume_name not deleted yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 10 ]]; then + echo "Volume failed to delete" + openstack volume show $volume_name + return 1 + fi + sleep 10 + result=$(openstack volume list --name $volume_name -f value -c ID) + done +} + function test_instance_boot { echo "TESTING: Server creation" openstack server create --wait --image cirros --flavor m1.tiny --key-name mykey --network demo-net kolla_boot_test @@ -30,44 +109,28 @@ function test_instance_boot { if [[ $SCENARIO == "ceph-ansible" ]] || [[ $SCENARIO == "zun" ]]; then echo "TESTING: Cinder volume attachment" - openstack volume create --size 2 test_volume - attempt=1 - while [[ $(openstack volume show 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 test_volume - return 1 - fi - sleep 10 - done - openstack server add volume kolla_boot_test test_volume --device /dev/vdb - attempt=1 - while [[ $(openstack volume show 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 test_volume - return 1 - fi - sleep 10 - done - openstack server remove volume kolla_boot_test test_volume - attempt=1 - while [[ $(openstack volume show 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 test_volume - return 1 - fi - sleep 10 - done - openstack volume delete test_volume + + create_a_volume test_volume + openstack volume show test_volume + attach_and_detach_a_volume test_volume kolla_boot_test + delete_a_volume test_volume + echo "SUCCESS: Cinder volume attachment" + + if [[ $HAS_UPGRADE == 'yes' ]]; then + echo "TESTING: Cinder volume upgrade stability (PHASE: $PHASE)" + + if [[ $PHASE == 'deploy' ]]; then + create_a_volume durable_volume + openstack volume show durable_volume + elif [[ $PHASE == 'upgrade' ]]; then + openstack volume show durable_volume + attach_and_detach_a_volume durable_volume kolla_boot_test + delete_a_volume durable_volume + fi + + echo "SUCCESS: Cinder volume upgrade stability (PHASE: $PHASE)" + fi fi echo "TESTING: Floating ip allocation" |
