diff --git a/novajoin_tempest_plugin/tests/scenario/manager.py b/novajoin_tempest_plugin/tests/scenario/manager.py index 0cad67f..b41ad06 100644 --- a/novajoin_tempest_plugin/tests/scenario/manager.py +++ b/novajoin_tempest_plugin/tests/scenario/manager.py @@ -14,6 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. +import os from oslo_log import log from tempest.common import image as common_image @@ -197,7 +198,22 @@ class ScenarioTest(tempest.test.BaseTestCase): image = body['image'] if 'image' in body else body # self.addCleanup(self.image_client.delete_image, image['id']) self.assertEqual("queued", image['status']) - img_path = CONF.scenario.img_dir + "/" + CONF.scenario.img_file + + img_path = CONF.scenario.img_file + if not os.path.exists(img_path): + # TODO(kopecmartin): replace LOG.warning for raising + # InvalidConfiguration exception when this plugin is meant to be + # used with only Tempest 27.0.0 and higher + LOG.warning( + 'Starting Tempest 25.0.0 release, CONF.scenario.img_file need ' + 'a full path for the image. CONF.scenario.img_dir was ' + 'deprecated and is removed in 27.0.0 release. Till Tempest ' + '27.0.0 (excluding), old behavior is maintained and kept ' + 'working but starting Tempest 27.0.0, only full path ' + 'CONF.scenario.img_file config option is accepted by the ' + 'Tempest.') + img_path = os.path.join(CONF.scenario.img_dir, img_path) + with open(img_path, 'rb') as image_file: if CONF.image_feature_enabled.api_v1: self.image_client.update_image(image['id'], data=image_file)