Pytest: Add installation-and-config test cases
1. 107-Logical-Volume-Resize.robot 2. 110-Validate-Partition-Modify-Operations.robot 3. 122-Attempt-Unlock-Host.robot 4. 123-Validate-Modified-System-Host-Disk-List.robot 5. 128-Test-Attempt-To-Increase-Partition-Size.robot 6. 133-Attempt-To-Decrease-Partition-Size.robot Signed-off-by: Yong Fu <fuyong@neusoft.com> Change-Id: Id5c4942d1679578a581532ee16daf7a7c490d3ba
This commit is contained in:
parent
a68778f64d
commit
6a0e346e11
|
@ -0,0 +1,12 @@
|
|||
from pytest import fixture, skip
|
||||
|
||||
from testfixtures.resource_mgmt import *
|
||||
from keywords import system_helper
|
||||
from utils.tis_log import LOG
|
||||
|
||||
|
||||
@fixture(scope='session')
|
||||
def no_aio_system():
|
||||
LOG.fixture_step("(Session) Skip if AIO system")
|
||||
if system_helper.is_aio_system():
|
||||
skip('skip if AIO system')
|
|
@ -0,0 +1,66 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Attempt to decrease the size of a partition.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from testfixtures.horizon import admin_home_pg, driver
|
||||
|
||||
from consts.auth import Tenant
|
||||
from keywords import storage_helper, system_helper
|
||||
from utils import cli
|
||||
from utils.clients.ssh import ControllerClient
|
||||
from utils.horizon.pages.admin.platform import systemconfigurationpage
|
||||
from utils.horizon.regions import forms
|
||||
from utils.tis_log import LOG
|
||||
|
||||
|
||||
@mark.installation
|
||||
def test_attempt_to_decrease_partition_size(admin_home_pg):
|
||||
"""
|
||||
133-Attempt-To-Decrease-Partition-Size.robot
|
||||
Args:
|
||||
admin_home_pg:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
con_ssh = ControllerClient.get_active_controller()
|
||||
if not system_helper.is_aio_system():
|
||||
host = system_helper.get_computes()[0]
|
||||
uuid = storage_helper.get_host_partitions(host, **{'status': 'In-Use'})[0]
|
||||
size = storage_helper.get_host_partition_values(host, uuid, fields='size_mib')[0]
|
||||
else:
|
||||
host = 'controller-0'
|
||||
uuid = storage_helper.get_host_partitions(host, **{'device_node': 'sdb1'})[0]
|
||||
size = storage_helper.get_host_partitions(host, uuid, fields='size_mib')[0]
|
||||
new_size = int(size) // 2048
|
||||
out = cli.system('host-disk-partition-modify', "{} {} -s {}".
|
||||
format(host, uuid, new_size), fail_ok=True, ssh_client=con_ssh,
|
||||
auth_info=Tenant.get('admin_platform'))[1]
|
||||
assert 'Requested partition size must be larger than current size' in out
|
||||
fs_size = storage_helper.get_controllerfs_list(fs_name='extension')[0]
|
||||
LOG.info("Go to System Configuration Page")
|
||||
systemconfiguration_pg = systemconfigurationpage.SystemConfigurationPage(admin_home_pg.driver)
|
||||
systemconfiguration_pg.go_to_target_page()
|
||||
systemconfiguration_pg.go_to_controller_filesystem_tab()
|
||||
size = fs_size // 2
|
||||
edit_form = systemconfiguration_pg.controllerfs_table.edit_filesystem()
|
||||
edit_form.extension.value = size
|
||||
edit_form._submit_element.click()
|
||||
edit_form.driver.switch_to_alert().accept()
|
||||
edit_form.wait_till_spinner_disappears()
|
||||
tab = systemconfiguration_pg.controllerfs_table
|
||||
edit_form = forms.FormRegion(tab.driver, field_mappings=tab.EDIT_FILESYSTEM_FORM_FIELDS)
|
||||
edit_form.cancel()
|
||||
element = systemconfiguration_pg.driver.find_element_by_xpath(
|
||||
"//div[@class=\"alert alert-dismissable fade in alert-danger\"]")
|
||||
assert "should be bigger than" in element.get_attribute('innerText')
|
|
@ -0,0 +1,28 @@
|
|||
from pytest import mark
|
||||
|
||||
from consts.auth import Tenant
|
||||
from keywords import storage_helper, system_helper
|
||||
from utils import cli
|
||||
from utils.clients.ssh import ControllerClient
|
||||
|
||||
|
||||
@mark.installation
|
||||
def test_attempt_to_increase_partition_size():
|
||||
"""
|
||||
128-Test-Attempt-To-Increase-Partition-Size.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
con_ssh = ControllerClient.get_active_controller()
|
||||
if not system_helper.is_aio_system():
|
||||
host = system_helper.get_computes()[0]
|
||||
uuid = storage_helper.get_host_partitions(host, **{'status': 'In-Use'})[0]
|
||||
else:
|
||||
host = 'controller-0'
|
||||
uuid = storage_helper.get_host_partitions(host, **{'device_node': 'sdb1'})[0]
|
||||
out = cli.system('host-disk-partition-modify', "{} {} -s '1111111111111111111111111'".
|
||||
format(host, uuid), fail_ok=True, ssh_client=con_ssh,
|
||||
auth_info=Tenant.get('admin_platform'))[1]
|
||||
assert "Expected '<type 'int'>', got '<type 'long'>'" in out
|
|
@ -0,0 +1,70 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Attempt unlock host where nova-local lvg exists but does not have physical volume.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import time
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from consts.auth import Tenant
|
||||
from keywords import system_helper, host_helper
|
||||
from utils import cli, table_parser, exceptions
|
||||
from utils.clients.ssh import ControllerClient
|
||||
from utils.tis_log import LOG
|
||||
|
||||
|
||||
def wait_for_host_lvg_status(host):
|
||||
LOG.info("waiting for state: provisioned")
|
||||
end_time = time.time() + 300
|
||||
table_ = table_parser.table(cli.system("host-lvg-list", host)[1])
|
||||
current_status = table_parser.get_values(table_, "State", **{"LVG Name": "nova-local"})[0]
|
||||
while time.time() < end_time:
|
||||
if current_status == "provisioned":
|
||||
LOG.info("host status has reached provisioned")
|
||||
return 0
|
||||
time.sleep(30)
|
||||
table_ = table_parser.table(cli.system("host-lvg-list", host)[1])
|
||||
current_status = table_parser.get_values(table_, "State", **{"LVG Name": "nova-local"})[0]
|
||||
err_msg = "Timed out waiting for state: provisioned."
|
||||
raise exceptions.VMTimeout(err_msg)
|
||||
|
||||
|
||||
@mark.installation
|
||||
def test_attempt_unlock_host(no_aio_system):
|
||||
"""
|
||||
122-Attempt-Unlock-Host.robot
|
||||
Args:
|
||||
no_aio_system:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
host = system_helper.get_computes()[1]
|
||||
con_ssh = ControllerClient.get_active_controller()
|
||||
auth_info = Tenant.get('admin_platform')
|
||||
host_helper.lock_host(host)
|
||||
table_ = table_parser.table(cli.system("host-lvg-list", host,
|
||||
ssh_client=con_ssh, auth_info=auth_info)[1])
|
||||
state = table_parser.get_values(table_, "State", **{"LVG Name": "nova-local"})[0]
|
||||
assert 'provisioned' == state
|
||||
|
||||
cli.system("host-lvg-delete", "{} nova-local".format(host), ssh_client=con_ssh, auth_info=auth_info)
|
||||
cli.system("host-lvg-add", "{} nova-local".format(host), ssh_client=con_ssh, auth_info=auth_info)
|
||||
wait_for_host_lvg_status(host)
|
||||
assert 'The nova-local volume group does not contain any physical volumes' in \
|
||||
host_helper.unlock_host(host, fail_ok=True)[1]
|
||||
|
||||
table_ = table_parser.table(cli.system("host-pv-list", host,
|
||||
ssh_client=con_ssh, auth_info=auth_info)[1])
|
||||
uuid = table_parser.get_values(table_, "disk_or_part_uuid", **{"lvm_vg_name": "nova-local"})[0]
|
||||
cli.system("host-pv-add", "{} nova-local {}".format(host, uuid), ssh_client=con_ssh,
|
||||
auth_info=auth_info)
|
||||
host_helper.unlock_host(host)
|
|
@ -0,0 +1,61 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Verify that logical volumes can be resized the controller (CLI/GUI).
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
import time
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from testfixtures.horizon import admin_home_pg, driver
|
||||
|
||||
from keywords import storage_helper
|
||||
from utils import exceptions
|
||||
from utils.horizon.pages.admin.platform import systemconfigurationpage
|
||||
from utils.tis_log import LOG
|
||||
|
||||
|
||||
def wait_for_controllerfs_status():
|
||||
LOG.info("waiting for state: available")
|
||||
end_time = time.time() + 300
|
||||
current_status = storage_helper.get_controllerfs_values('extension', fields='state')[0]
|
||||
while time.time() < end_time:
|
||||
if current_status == "available":
|
||||
LOG.info("host status has reached available")
|
||||
return 0
|
||||
time.sleep(30)
|
||||
current_status = storage_helper.get_controllerfs_values('extension', fields='state')[0]
|
||||
err_msg = "Timed out waiting for state: available."
|
||||
raise exceptions.VMTimeout(err_msg)
|
||||
|
||||
|
||||
@mark.installation
|
||||
def test_logical_volume_resize(admin_home_pg):
|
||||
"""
|
||||
107-Logical-Volume-Resize.robot
|
||||
Args:
|
||||
admin_home_pg:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
fs_size = storage_helper.get_controllerfs_list(fs_name='extension')[0]
|
||||
next_size = fs_size + 1
|
||||
storage_helper.modify_controllerfs(**{'extension': next_size})
|
||||
assert next_size == storage_helper.get_controllerfs_list(fs_name='extension')[0]
|
||||
wait_for_controllerfs_status()
|
||||
LOG.info("Go to System Configuration Page")
|
||||
systemconfiguration_pg = systemconfigurationpage.SystemConfigurationPage(admin_home_pg.driver)
|
||||
systemconfiguration_pg.go_to_target_page()
|
||||
systemconfiguration_pg.go_to_controller_filesystem_tab()
|
||||
size = next_size + 1
|
||||
systemconfiguration_pg.edit_filesystem(extension=size)
|
||||
assert size == storage_helper.get_controllerfs_list(fs_name='extension')[0]
|
||||
wait_for_controllerfs_status()
|
|
@ -0,0 +1,30 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Verify Gib Column Present.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from keywords import system_helper, storage_helper
|
||||
|
||||
|
||||
@mark.installation
|
||||
def test_validate_modified_system_host_disk_list(no_aio_system):
|
||||
"""
|
||||
123-Validate-Modified-System-Host-Disk-List.robot
|
||||
Args:
|
||||
no_aio_system:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
compute = system_helper.get_computes()[0]
|
||||
out = storage_helper.get_host_disks(compute, field='available_gib')
|
||||
assert out
|
|
@ -0,0 +1,39 @@
|
|||
###
|
||||
#
|
||||
# Copyright (c) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# This test case validates that the partition has no changes cause
|
||||
# the input has not the required parameter.
|
||||
#
|
||||
# Author(s): Yong.Fu <yongx.fu@intel.com>
|
||||
#
|
||||
###
|
||||
|
||||
from pytest import mark
|
||||
|
||||
from consts.auth import Tenant
|
||||
from keywords import storage_helper, system_helper
|
||||
from utils import cli
|
||||
from utils.clients.ssh import ControllerClient
|
||||
|
||||
|
||||
@mark.installation
|
||||
def test_validate_partition_modify_operations():
|
||||
"""
|
||||
110-Validate-Partition-Modify-Operations.robot
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
con_ssh = ControllerClient.get_active_controller()
|
||||
if system_helper.is_aio_system():
|
||||
host = 'controller-0'
|
||||
else:
|
||||
host = system_helper.get_computes()[0]
|
||||
uuid = storage_helper.get_host_partitions(host)[0]
|
||||
code, msg = cli.system('host-disk-partition-modify', "{} {}".format(host, uuid), fail_ok=True,
|
||||
ssh_client=con_ssh, auth_info=Tenant.get('admin_platform'))
|
||||
assert code != 0 and 'No update parameters specified, partition is unchanged.' == msg
|
|
@ -447,7 +447,9 @@ class SystemConfigurationPage(basepage.BasePage):
|
|||
if cancel:
|
||||
edit_form.cancel()
|
||||
else:
|
||||
edit_form.submit()
|
||||
edit_form._submit_element.click()
|
||||
edit_form.driver.switch_to_alert().accept()
|
||||
edit_form.wait_till_spinner_disappears()
|
||||
|
||||
def edit_storage_pool(self, tier_name, cinder_pool=None, glance_pool=None,
|
||||
ephemeral_pool=None, object_pool=None, cancel=False):
|
||||
|
|
Loading…
Reference in New Issue