Merge "Adding changes for PCQE-210 and PCQE-219 on 17-JUL-2018"

This commit is contained in:
Zuul 2018-08-08 14:07:57 +00:00 committed by Gerrit Code Review
commit e1f9451255
3 changed files with 70 additions and 0 deletions

View File

@ -28,6 +28,10 @@ from cloudcafe.compute.common.clients.ping import PingClient
from cloudcafe.compute.common.exceptions import ServerUnreachable
from cloudcafe.objectstorage.composites import ObjectStorageComposite
#Added by SKS - 11-JUL-2018
from cloudcafe.blockstorage.volumes_api.common.config import VolumesAPIConfig
# AdditionEnd SKS
class ComputeFixture(BaseTestFixture):
"""
@ -43,6 +47,11 @@ class ComputeFixture(BaseTestFixture):
cls.flavors_config = cls.compute.flavors.config
cls.images_config = cls.compute.images.config
cls.servers_config = cls.compute.servers.config
# Added by SKS 11-Jul-2018
cls.volumes_config = VolumesAPIConfig()
# AdditionEnd SKS
cls.compute_endpoint = ComputeEndpointConfig()
cls.marshalling = MarshallingConfig()
cls.config_drive_config = cls.compute.config_drive.config
@ -55,6 +64,11 @@ class ComputeFixture(BaseTestFixture):
cls.flavor_ref_alt = cls.flavors_config.secondary_flavor
cls.image_ref = cls.images_config.primary_image
cls.image_ref_alt = cls.images_config.secondary_image
# Added by SKS- 11-jul-2018
cls.bootable_volume_ref = cls.volumes_config.primary_bootable_volume
# AdditionEnd
cls.disk_path = cls.servers_config.instance_disk_path
cls.split_ephemeral_disk_enabled = \
cls.servers_config.split_ephemeral_disk_enabled

View File

@ -0,0 +1,38 @@
"""
Copyright 2014 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from cafe.drivers.unittest.decorators import tags
from cloudcafe.common.tools.datagen import rand_name
from cloudcafe.compute.common.exceptions import BadRequest
from cloudroast.compute.fixtures import ServerFromVolumeV1Fixture
class CreateVolumeV1ServerNegativeTest(ServerFromVolumeV1Fixture):
@tags(type='smoke', net='no')
def test_device_name_invalid(self):
"""Verify device type set to SSD throws bad request"""
# Creating block device
# Attempted code for verification of VIRT-2837
self.block_data = self.server_behaviors.create_block_device_mapping_v1_virt2837(
device_name="SSD",
volume_id=self.bootable_volume_ref,
delete_on_termination=True)
# Try Creating Instance from Volume V1
with self.assertRaises(BadRequest):
self.boot_from_volume_client.create_server_virt2837(
block_device_mapping_v1=self.block_data,
flavor_ref=self.flavors_config.primary_flavor,
name=rand_name("server"))

View File

@ -92,3 +92,21 @@ class CreateVolumeServerNegativeTest(ServerFromVolumeV2Fixture):
block_device_mapping_v2=self.block_data,
flavor_ref='invalid',
name=rand_name("server"))
@tags(type='smoke', net='no')
def test_destination_type_not_provided(self):
"""Verify when destination type not provided throws bad request"""
# This is to verify VIRT-3099
# Creating block device with snapshot data inside
# Question: Will the existing logic support it if destination_type is omitted altogether?
# Question 2: uuid must be assigned a volume id or reference. How to provide that?
self.block_data = self.server_behaviors.create_block_device_mapping_v2_virt3099(
boot_index=0, uuid=self.bootable_volume_ref,
source_type='volume',
delete_on_termination=True)
# Try Creating Instance from Volume V2
with self.assertRaises(BadRequest):
self.boot_from_volume_client.create_server(
block_device_mapping_v2=self.block_data,
flavor_ref=self.flavors_config.primary_flavor,
name=rand_name("server"))