Merge "Update CI for Dalmatian"
diff --git a/cinder_tempest_plugin/api/volume/base.py b/cinder_tempest_plugin/api/volume/base.py
index 1fd82bf..c0f53bd 100644
--- a/cinder_tempest_plugin/api/volume/base.py
+++ b/cinder_tempest_plugin/api/volume/base.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import io
+
from tempest.common import compute
from tempest.common import waiters
from tempest import config
@@ -158,6 +160,29 @@
body['id'])
return body
+ @classmethod
+ def create_image_with_data(cls, **kwargs):
+ # we do this as a class method so we can use the
+ # addClassResourceCleanup functionality of tempest.test.BaseTestCase
+ images_client = cls.os_primary.image_client_v2
+ if 'min_disk' not in kwargs:
+ kwargs['min_disk'] = 1
+ response = images_client.create_image(**kwargs)
+ image_id = response['id']
+ cls.addClassResourceCleanup(
+ images_client.wait_for_resource_deletion, image_id)
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ images_client.delete_image, image_id)
+
+ # upload "data" to image
+ image_file = io.BytesIO(data_utils.random_bytes(size=1024))
+ images_client.store_image_file(image_id, image_file)
+
+ waiters.wait_for_image_status(images_client, image_id, 'active')
+ image = images_client.show_image(image_id)
+ return image
+
class BaseVolumeAdminTest(BaseVolumeTest):
"""Base test case class for all Volume Admin API tests."""
diff --git a/cinder_tempest_plugin/api/volume/test_create_from_image.py b/cinder_tempest_plugin/api/volume/test_create_from_image.py
index acb1943..f44f630 100644
--- a/cinder_tempest_plugin/api/volume/test_create_from_image.py
+++ b/cinder_tempest_plugin/api/volume/test_create_from_image.py
@@ -10,12 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import io
-
-from tempest.common import waiters
from tempest import config
-from tempest.lib.common.utils import data_utils
-from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from cinder_tempest_plugin.api.volume import base
@@ -32,29 +27,6 @@
if not CONF.service_available.glance:
raise cls.skipException("Glance service is disabled")
- @classmethod
- def create_image_with_data(cls, **kwargs):
- # we do this as a class method so we can use the
- # addClassResourceCleanup functionality of tempest.test.BaseTestCase
- images_client = cls.os_primary.image_client_v2
- if 'min_disk' not in kwargs:
- kwargs['min_disk'] = 1
- response = images_client.create_image(**kwargs)
- image_id = response['id']
- cls.addClassResourceCleanup(
- images_client.wait_for_resource_deletion, image_id)
- cls.addClassResourceCleanup(
- test_utils.call_and_ignore_notfound_exc,
- images_client.delete_image, image_id)
-
- # upload "data" to image
- image_file = io.BytesIO(data_utils.random_bytes(size=1024))
- images_client.store_image_file(image_id, image_file)
-
- waiters.wait_for_image_status(images_client, image_id, 'active')
- image = images_client.show_image(image_id)
- return image
-
@decorators.idempotent_id('6e9266ff-a917-4dd5-aa4a-c36e59e7a2a6')
def test_create_from_image_with_volume_type_image_property(self):
"""Verify that the cinder_img_volume_type image property works.