Select proper flavor_ref_alt for Tempest

Currently if user selects the default instance type for Tempest
tests, some of resize-related tests may fail due to resize attempt
into flavor with smaller disk size. It is because there is just
simple check if flavor_ref and flavor_ref_alt (IDs) aren't the same.
To ensure resize is really possible, there shall be additional
verification introduced.

Co-Authored-By: Michał Madarasz <michal.madarasz@corp.ovh.com>
Change-Id: Iaa1bfa9cb76cbe54be658d2d70d97d99e7fb5be9
This commit is contained in:
Szymon Datko 2019-08-22 15:39:53 +02:00
parent 78e94096ce
commit 28c498150d

View File

@ -130,6 +130,8 @@ function configure_tempest {
local available_flavors
local flavors_ref
local flavor_lines
local flavor_ref_size
local flavor_ref_alt_size
local public_network_id
local public_router_id
local ssh_connect_method="floating"
@ -233,11 +235,24 @@ function configure_tempest {
fi
flavor_ref=${flavors[0]}
flavor_ref_alt=$flavor_ref
flavor_ref_size=$(openstack flavor show --format value --column disk "${flavor_ref}")
# Ensure ``flavor_ref`` and ``flavor_ref_alt`` have different values.
# Some resize instance in tempest tests depends on this.
for f in ${flavors[@]:1}; do
if [[ "$f" != "$flavor_ref" ]]; then
#
# NOTE(sdatko): Resize is only possible when target flavor
# is not smaller than the original one. For
# Tempest tests, in case there was a bigger
# flavor selected as default, e.g. m1.small,
# we need to perform additional check.
#
flavor_ref_alt_size=$(openstack flavor show --format value --column disk "${f}")
if [[ "${flavor_ref_alt_size}" -lt "${flavor_ref_size}" ]]; then
continue
fi
flavor_ref_alt=$f
break
fi