Stop using removed option [scenario]/img_dir

The [scenario]/img_dir configuration option was removed from tempest in
version 27.0.0. This makes test_minimum_basic_scenario fail with:

Traceback (most recent call last):
  File "/home/ubuntu/.rally/verification/verifier-434bee71-a8c0-480d-a511-11a2bc1bda97/repo/tempest/common/utils/__init__.py", line 70, in wrapper
    return f(*func_args, **func_kwargs)
  File "/home/ubuntu/.rally/verification/verifier-434bee71-a8c0-480d-a511-11a2bc1bda97/repo/tempest/scenario/test_minimum_basic.py", line 109, in test_minimum_basic_scenario
    image = self.image_create()
  File "/home/ubuntu/.rally/verification/verifier-434bee71-a8c0-480d-a511-11a2bc1bda97/repo/tempest/scenario/manager.py", line 769, in image_create
    with open(img_path, 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'tempest-image'

Use [scenario]/img_file with a full path to the image instead.

+ skip several tests at CI

Co-Authored-By: Andrey Kurilin <andr.kurilin@gmail.com>

Change-Id: I9b9f339e758547e059080b247c8bd8bcf1b749ee
Closes-Bug: #1928807
This commit is contained in:
Pierre Riteau 2021-05-19 12:50:55 +02:00 committed by Andrey Kurilin
parent 8951fed638
commit eba9341bf9
6 changed files with 73 additions and 28 deletions

View File

@ -79,8 +79,7 @@
# watcher-api did not start last time # watcher-api did not start last time
voting: false voting: false
- rally-task-zaqar - rally-task-zaqar
- rally-verify-tempest: - rally-verify-tempest
voting: false
gate: gate:
jobs: jobs:
- rally-tox-cover - rally-tox-cover
@ -117,6 +116,7 @@
- rally_openstack/task/scenarios/neutron/network.py - rally_openstack/task/scenarios/neutron/network.py
- tests/ci/playbooks - tests/ci/playbooks
- rally-task-zaqar - rally-task-zaqar
- rally-verify-tempest
post: post:
jobs: jobs:
- rally-openstack-docker-build-and-push: - rally-openstack-docker-build-and-push:

View File

@ -16,6 +16,15 @@ Changelog
.. Release notes for existing releases are MUTABLE! If there is something that .. Release notes for existing releases are MUTABLE! If there is something that
was missed or can be improved, feel free to change it! was missed or can be improved, feel free to change it!
unreleased
----------
Fixed
~~~~~
Compatibility with Tempest >= 27
[2.1.0] - 2020-11-03 [2.1.0] - 2020-11-03
-------------------- --------------------

View File

@ -46,7 +46,6 @@ lock_path =
instance_type = instance_type =
[scenario] [scenario]
img_dir =
img_file = img_file =
[service_available] [service_available]

View File

@ -64,6 +64,20 @@ class TempestContext(context.VerifierContext):
self._created_flavors = [] self._created_flavors = []
self._created_networks = [] self._created_networks = []
def _configure_img_options(self):
try:
tempest_major_version = int(self.verifier.version.split(".", 1)[0])
except ValueError:
# use latest flow by default
tempest_major_version = 27
if tempest_major_version < 27:
self._configure_option("scenario", "img_dir", self.data_dir)
img_file = self.image_name
else:
img_file = self.data_dir + "/" + self.image_name
self._configure_option("scenario", "img_file", img_file,
helper_method=self._download_image)
def setup(self): def setup(self):
self.conf.read(self.conf_path) self.conf.read(self.conf_path)
@ -75,9 +89,7 @@ class TempestContext(context.VerifierContext):
os.path.join(self.data_dir, "tempest.log")) os.path.join(self.data_dir, "tempest.log"))
self._configure_option("oslo_concurrency", "lock_path", self._configure_option("oslo_concurrency", "lock_path",
os.path.join(self.data_dir, "lock_files")) os.path.join(self.data_dir, "lock_files"))
self._configure_option("scenario", "img_dir", self.data_dir) self._configure_img_options()
self._configure_option("scenario", "img_file", self.image_name,
helper_method=self._download_image)
self._configure_option("compute", "image_ref", self._configure_option("compute", "image_ref",
helper_method=self._discover_or_create_image) helper_method=self._discover_or_create_image)
self._configure_option("compute", "image_ref_alt", self._configure_option("compute", "image_ref_alt",

View File

@ -80,10 +80,10 @@ class Step(object):
"skipped or finished with an error." % "skipped or finished with an error." %
(self.name, results[self.DEPENDS_ON].name)) (self.name, results[self.DEPENDS_ON].name))
stdout_file = self._generate_path( stdout_file = self._generate_path(
"%s.txt.gz" % self.__class__.__name__) "%s.txt" % self.__class__.__name__)
self.result["output_file"] = self._write_file( self.result["output_file"] = self._write_file(
stdout_file, msg, compress=True) stdout_file, msg, compress=False)
return False return False
return True return True
@ -99,9 +99,9 @@ class Step(object):
self.result["cmd"] = cmd self.result["cmd"] = cmd
self.result["status"], self.result["output"] = self.call_rally(cmd) self.result["status"], self.result["output"] = self.call_rally(cmd)
stdout_file = self._generate_path("%s.txt.gz" % cmd) stdout_file = self._generate_path("%s.txt" % cmd)
self.result["output_file"] = self._write_file( self.result["output_file"] = self._write_file(
stdout_file, self.result["output"], compress=True) stdout_file, self.result["output"], compress=False)
@classmethod @classmethod
def _generate_path(cls, root): def _generate_path(cls, root):
@ -317,12 +317,34 @@ class RunVerification(Step):
SKIP_TESTS = { SKIP_TESTS = {
"tempest.api.compute.flavors.test_flavors.FlavorsV2TestJSON." "tempest.api.compute.flavors.test_flavors.FlavorsV2TestJSON."
"test_get_flavor[id-1f12046b-753d-40d2-abb6-d8eb8b30cb2f,smoke]": "test_get_flavor[id-1f12046b-753d-40d2-abb6-d8eb8b30cb2f,smoke]":
"This test was skipped intentionally"} "This test was skipped intentionally",
}
XFAIL_TESTS = { XFAIL_TESTS = {
"tempest.api.compute.servers.test_server_actions." "tempest.scenario.test_dashboard_basic_ops"
"ServerActionsTestJSON.test_get_vnc_console" ".TestDashboardBasicOps.test_basic_scenario"
"[id-c6bc11bf-592e-4015-9319-1c98dc64daf5]": "[dashboard,id-4f8851b1-0e69-482b-b63b-84c6e76f6c80,smoke]":
"This test fails because 'novnc' console type is unavailable"} "Fails for unknown reason",
"tempest.api.compute.servers.test_attach_interfaces"
".AttachInterfacesUnderV243Test.test_add_remove_fixed_ip"
"[id-c7e0e60b-ee45-43d0-abeb-8596fd42a2f9,network,smoke]":
"Fails for unknown reason",
"tempest.scenario.test_network_basic_ops"
".TestNetworkBasicOps.test_network_basic_ops"
"[compute,id-f323b3ba-82f8-4db7-8ea6-6a895869ec49,network,smoke]":
"Fails for unknown reason",
"tempest.scenario.test_server_basic_ops"
".TestServerBasicOps.test_server_basic_ops"
"[compute,id-7fff3fb3-91d8-4fd0-bd7d-0204f1f180ba,network,smoke]":
"Fails for unknown reason",
"tempest.api.compute.servers.test_server_actions"
".ServerActionsTestJSON.test_reboot_server_hard"
"[id-2cb1baf6-ac8d-4429-bf0d-ba8a0ba53e32,smoke]":
"Fails for unknown reason"
}
def setUp(self): def setUp(self):
self.CALL_ARGS["tag"] = "tag-1 tag-2" self.CALL_ARGS["tag"] = "tag-1 tag-2"
@ -396,14 +418,6 @@ class ReportVerificationMixin(Step):
print(self.COMMAND % self.CALL_ARGS) print(self.COMMAND % self.CALL_ARGS)
self.result["out"] = "<None>" self.result["out"] = "<None>"
def run(self):
super(ReportVerificationMixin, self).run()
creport = "%s.gz" % self.CALL_ARGS["out"]
with open(self.CALL_ARGS["out"], "rb") as f_in:
with gzip.open(creport, "wb") as f_out:
f_out.writelines(f_in)
self.result["out"] = creport
class HtmlVerificationReport(ReportVerificationMixin): class HtmlVerificationReport(ReportVerificationMixin):
"""Generate HTML report for verification(s).""" """Generate HTML report for verification(s)."""

View File

@ -369,7 +369,7 @@ class TempestContextTestCase(test.TestCase):
def test_setup(self, mock_create_dir, def test_setup(self, mock_create_dir,
mock__create_tempest_roles, mock__configure_option, mock__create_tempest_roles, mock__configure_option,
mock_open): mock_open):
verifier = mock.Mock(env=self.env) verifier = mock.Mock(env=self.env, version="27.1.0")
verifier.manager.home_dir = "/p/a/t/h" verifier.manager.home_dir = "/p/a/t/h"
# case #1: no neutron and heat # case #1: no neutron and heat
@ -387,8 +387,7 @@ class TempestContextTestCase(test.TestCase):
self.assertEqual( self.assertEqual(
[mock.call("DEFAULT", "log_file", "/p/a/t/h/tempest.log"), [mock.call("DEFAULT", "log_file", "/p/a/t/h/tempest.log"),
mock.call("oslo_concurrency", "lock_path", "/p/a/t/h/lock_files"), mock.call("oslo_concurrency", "lock_path", "/p/a/t/h/lock_files"),
mock.call("scenario", "img_dir", "/p/a/t/h"), mock.call("scenario", "img_file", "/p/a/t/h/" + ctx.image_name,
mock.call("scenario", "img_file", ctx.image_name,
helper_method=ctx._download_image), helper_method=ctx._download_image),
mock.call("compute", "image_ref", mock.call("compute", "image_ref",
helper_method=ctx._discover_or_create_image), helper_method=ctx._discover_or_create_image),
@ -427,8 +426,7 @@ class TempestContextTestCase(test.TestCase):
self.assertEqual([ self.assertEqual([
mock.call("DEFAULT", "log_file", "/p/a/t/h/tempest.log"), mock.call("DEFAULT", "log_file", "/p/a/t/h/tempest.log"),
mock.call("oslo_concurrency", "lock_path", "/p/a/t/h/lock_files"), mock.call("oslo_concurrency", "lock_path", "/p/a/t/h/lock_files"),
mock.call("scenario", "img_dir", "/p/a/t/h"), mock.call("scenario", "img_file", "/p/a/t/h/" + ctx.image_name,
mock.call("scenario", "img_file", ctx.image_name,
helper_method=ctx._download_image), helper_method=ctx._download_image),
mock.call("compute", "image_ref", mock.call("compute", "image_ref",
helper_method=ctx._discover_or_create_image), helper_method=ctx._discover_or_create_image),
@ -449,3 +447,16 @@ class TempestContextTestCase(test.TestCase):
flv_ram=config.CONF.openstack.heat_instance_type_ram, flv_ram=config.CONF.openstack.heat_instance_type_ram,
flv_disk=config.CONF.openstack.heat_instance_type_disk) flv_disk=config.CONF.openstack.heat_instance_type_disk)
], mock__configure_option.call_args_list) ], mock__configure_option.call_args_list)
# case 3: tempest is old.
verifier.version = "17.0.0"
ctx = context.TempestContext({"verifier": verifier})
ctx.conf = mock.Mock()
ctx.setup()
mock__configure_option.assert_has_calls(
[
mock.call("scenario", "img_dir", "/p/a/t/h"),
mock.call("scenario", "img_file", ctx.image_name,
helper_method=ctx._download_image)
]
)