Validate hw_video_type image property

This patch tests the hw_video_type image
property with values virtio and none.

Change-Id: Iea5c2a73674a97ad212cfcf5f8dea9185f8bda27
This commit is contained in:
Paras Babbar 2020-05-21 18:20:46 -04:00 committed by Paras Babbar
parent 36e4ca58f4
commit 20e04f5e47
2 changed files with 61 additions and 0 deletions

View File

@ -46,6 +46,7 @@
tox_envlist: all tox_envlist: all
tempest_concurrency: 1 tempest_concurrency: 1
tempest_test_regex: ^whitebox_tempest_plugin\. tempest_test_regex: ^whitebox_tempest_plugin\.
tempest_black_regex: "create_none_instance|virtio_to_none|none_to_virtio"
devstack_plugins: devstack_plugins:
whitebox-tempest-plugin: https://opendev.org/x/whitebox-tempest-plugin.git whitebox-tempest-plugin: https://opendev.org/x/whitebox-tempest-plugin.git
devstack_localrc: devstack_localrc:

View File

@ -0,0 +1,60 @@
# Copyright 2020 Red Hat
# All Rights Reserved.
#
# 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 tempest.common import waiters
from whitebox_tempest_plugin.api.compute import base
class HwVideoModelTest(base.BaseWhiteboxComputeTest):
"""Tests the support of different hardware video model type
virtio and none that can be set through image
meta data property flag "hw_video_model".
"""
def setUp(self):
super(HwVideoModelTest, self).setUp()
self.virtio_image_id = self.copy_default_image(hw_video_model='virtio')
self.none_image_id = self.copy_default_image(hw_video_model='none')
def _assert_hw_video_type(self, server, hw_video_type):
root = self.get_server_xml(server['id'])
hw_video = root.find('./devices/video/model')
self.assertEqual(hw_video_type, hw_video.get('type'))
def test_create_virtio_instance(self):
server = self.create_test_server(image_id=self.virtio_image_id)
self._assert_hw_video_type(server, 'virtio')
def test_create_none_instance(self):
server = self.create_test_server(image_id=self.none_image_id)
self._assert_hw_video_type(server, 'none')
def test_rebuild_virtio_to_none(self):
server = self.create_test_server(image_id=self.virtio_image_id)
self._assert_hw_video_type(server, 'virtio')
self.servers_client.rebuild_server(server['id'], self.none_image_id)
waiters.wait_for_server_status(self.servers_client, server['id'],
'ACTIVE')
self._assert_hw_video_type(server, 'none')
def test_rebuild_none_to_virtio(self):
server = self.create_test_server(image_id=self.virtio_image_id)
self._assert_hw_video_type(server, 'virtio')
self.servers_client.rebuild_server(server['id'], self.none_image_id)
waiters.wait_for_server_status(self.servers_client, server['id'],
'ACTIVE')
self._assert_hw_video_type(server, 'none')