Update Openstack Install and version retrieval tests
Change-Id: I2b9fd60bed558ef646406dad96fee00abcb0f5a8 Signed-off-by: Sandeep Kapur <sandeep.kapur@windriver.com>
This commit is contained in:
@@ -14,6 +14,6 @@
|
||||
"custom": {
|
||||
"enabled": true,
|
||||
"file_location": "/home/sysadmin/",
|
||||
"file_name": "helm-chart-manifest.tgz"
|
||||
"file_name": "helm-charts-manifest.tgz"
|
||||
}
|
||||
}
|
@@ -4,13 +4,14 @@ class CustomInstaller:
|
||||
"""
|
||||
|
||||
def __init__(self, custom_dict: []):
|
||||
self.enabled_flag = custom_dict['enabled']
|
||||
self.file_location = custom_dict['file_location']
|
||||
self.file_name = custom_dict['file_location']
|
||||
self.enabled_flag = custom_dict["enabled"]
|
||||
self.file_location = custom_dict["file_location"]
|
||||
self.file_name = custom_dict["file_name"]
|
||||
|
||||
def get_enabled_flag(self) -> str:
|
||||
"""
|
||||
Getter for custom enabled flag
|
||||
|
||||
Returns: the enabled_flag
|
||||
|
||||
"""
|
||||
@@ -19,6 +20,7 @@ class CustomInstaller:
|
||||
def get_file_location(self) -> str:
|
||||
"""
|
||||
Getter for helm file location
|
||||
|
||||
Returns: the file_location
|
||||
|
||||
"""
|
||||
@@ -27,6 +29,7 @@ class CustomInstaller:
|
||||
def get_file_name(self) -> str:
|
||||
"""
|
||||
Getter for helm file name
|
||||
|
||||
Returns: the file_name
|
||||
|
||||
"""
|
||||
@@ -35,6 +38,7 @@ class CustomInstaller:
|
||||
def get_file_path(self) -> str:
|
||||
"""
|
||||
This function will return a single string representation of the file path of custom object
|
||||
|
||||
Returns: str
|
||||
|
||||
"""
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from framework.logging.automation_logger import get_logger
|
||||
from framework.ssh.ssh_connection import SSHConnection
|
||||
from keywords.base_keyword import BaseKeyword
|
||||
from keywords.cloud_platform.command_wrappers import source_openrc
|
||||
from keywords.cloud_platform.system.application.object.system_application_output import SystemApplicationOutput
|
||||
@@ -12,29 +13,31 @@ class SystemApplicationApplyKeywords(BaseKeyword):
|
||||
Class for System application keywords
|
||||
"""
|
||||
|
||||
def __init__(self, ssh_connection):
|
||||
def __init__(self, ssh_connection: SSHConnection):
|
||||
"""
|
||||
Constructor
|
||||
|
||||
Args:
|
||||
ssh_connection:
|
||||
ssh_connection (SSHConnection): ssh object
|
||||
"""
|
||||
self.ssh_connection = ssh_connection
|
||||
|
||||
def system_application_apply(self, app_name: str) -> SystemApplicationOutput:
|
||||
def system_application_apply(self, app_name: str, timeout: int = 300, polling_sleep_time: int = 5) -> SystemApplicationOutput:
|
||||
"""
|
||||
Executes the applying of an application file by executing the command 'system application-apply'. This method
|
||||
returns upon the completion of the 'system application-apply' command, that is, when the 'status' is 'applied'.
|
||||
|
||||
returns upon the completion of the 'system application-apply' command, that is, when the 'status' is 'applied'.
|
||||
Executes the installation of an application by executing the command 'system application-apply'.
|
||||
Args:
|
||||
app_name (str): the name of the application to apply
|
||||
timeout (int): Timeout in seconds
|
||||
polling_sleep_time (int): wait time in seconds before the next attempt when unsuccessful validation
|
||||
|
||||
Returns:
|
||||
SystemApplicationOutput: an object representing status values related to the current installation
|
||||
process of the application, as a result of the execution of the 'system application-apply' command.
|
||||
|
||||
"""
|
||||
|
||||
# Gets the command 'system application-apply' with its parameters configured.
|
||||
cmd = self.get_command(app_name)
|
||||
|
||||
@@ -45,7 +48,7 @@ class SystemApplicationApplyKeywords(BaseKeyword):
|
||||
|
||||
# Tracks the execution of the command 'system application-apply' until its completion or a timeout.
|
||||
system_application_list_keywords = SystemApplicationListKeywords(self.ssh_connection)
|
||||
system_application_list_keywords.validate_app_status(app_name, "applied")
|
||||
system_application_list_keywords.validate_app_status(app_name, "applied", timeout, polling_sleep_time)
|
||||
|
||||
# If the execution arrived here the status of the application is 'applied'.
|
||||
system_application_output.get_system_application_object().set_status("applied")
|
||||
@@ -55,6 +58,7 @@ class SystemApplicationApplyKeywords(BaseKeyword):
|
||||
def is_already_applied(self, app_name: str) -> bool:
|
||||
"""
|
||||
Verifies if the application has already been applied.
|
||||
|
||||
Args:
|
||||
app_name (str): a string representing the name of the application.
|
||||
|
||||
@@ -84,20 +88,20 @@ class SystemApplicationApplyKeywords(BaseKeyword):
|
||||
the 'system_application_apply_input' argument.
|
||||
|
||||
"""
|
||||
|
||||
if String.is_empty(app_name):
|
||||
error_message = "The app_name property must be specified."
|
||||
get_logger().log_exception(error_message)
|
||||
raise ValueError(error_message)
|
||||
|
||||
# Assembles the command 'system application-apply'.
|
||||
cmd = f'system application-apply {app_name}'
|
||||
cmd = f"system application-apply {app_name}"
|
||||
|
||||
return cmd
|
||||
|
||||
def is_applied_or_failed(self, app_name: str) -> bool:
|
||||
"""
|
||||
Verifies if the application has already been applied or apply-failed.
|
||||
|
||||
Args:
|
||||
app_name (str): a string representing the name of the application.
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
from config.configuration_file_locations_manager import ConfigurationFileLocationsManager
|
||||
from config.configuration_manager import ConfigurationManagerClass
|
||||
from config.configuration_manager import ConfigurationManager
|
||||
from framework.logging.automation_logger import get_logger
|
||||
from keywords.cloud_platform.ssh.lab_connection_keywords import LabConnectionKeywords
|
||||
from keywords.cloud_platform.system.application.object.system_application_status_enum import SystemApplicationStatusEnum
|
||||
@@ -23,16 +22,13 @@ def test_openstack_install():
|
||||
get_logger().log_info("App Install Step")
|
||||
# Setups the upload input object.
|
||||
system_application_upload_input = SystemApplicationUploadInput()
|
||||
configuration_manager = ConfigurationManagerClass()
|
||||
config_file_locations = ConfigurationFileLocationsManager()
|
||||
configuration_manager.load_configs(config_file_locations)
|
||||
app_name = configuration_manager.get_openstack_config().get_app_name()
|
||||
app_name = ConfigurationManager.get_openstack_config().get_app_name()
|
||||
system_application_upload_input.set_app_name(app_name)
|
||||
if configuration_manager.get_openstack_config().get_remote_config().get_enabled_flag():
|
||||
system_application_upload_input.set_app_version(configuration_manager.get_openstack_config().get_remote_config().get_app_version())
|
||||
if ConfigurationManager.get_openstack_config().get_remote_config().get_enabled_flag():
|
||||
system_application_upload_input.set_app_version(ConfigurationManager.get_openstack_config().get_remote_config().get_app_version())
|
||||
system_application_upload_input.set_automatic_installation(False)
|
||||
elif configuration_manager.get_openstack_config().get_custom_config().get_enabled_flag():
|
||||
system_application_upload_input.set_tar_file_path(configuration_manager.get_openstack_config().get_custom_config().get_file_path())
|
||||
elif ConfigurationManager.get_openstack_config().get_custom_config().get_enabled_flag():
|
||||
system_application_upload_input.set_tar_file_path(ConfigurationManager.get_openstack_config().get_custom_config().get_file_path())
|
||||
system_application_upload_input.set_force(True)
|
||||
# Setups app configs and lab connection
|
||||
lab_connect_keywords = LabConnectionKeywords()
|
||||
@@ -56,7 +52,7 @@ def test_openstack_install():
|
||||
|
||||
# Asserts that the applying process concluded successfully
|
||||
# Executes the application installation
|
||||
system_application_apply_output = SystemApplicationApplyKeywords(ssh_connection).system_application_apply(app_name)
|
||||
system_application_apply_output = SystemApplicationApplyKeywords(ssh_connection).system_application_apply(app_name, 3600, 30)
|
||||
system_application_object = system_application_apply_output.get_system_application_object()
|
||||
assert system_application_object is not None, f"Expecting 'system_application_object' as not None, Observed: {system_application_object}."
|
||||
assert system_application_object.get_name() == app_name, f"Expecting 'app_name' = {app_name}, Observed: {system_application_object.get_name()}."
|
||||
|
@@ -1,5 +1,4 @@
|
||||
from config.configuration_file_locations_manager import ConfigurationFileLocationsManager
|
||||
from config.configuration_manager import ConfigurationManagerClass
|
||||
from config.configuration_manager import ConfigurationManager
|
||||
from framework.logging.automation_logger import get_logger
|
||||
from keywords.cloud_platform.ssh.lab_connection_keywords import LabConnectionKeywords
|
||||
|
||||
@@ -14,10 +13,7 @@ def test_openstack_version():
|
||||
- retrieve the openstack version and log the important values like name, version & build date
|
||||
|
||||
"""
|
||||
configuration_manager = ConfigurationManagerClass()
|
||||
config_file_locations = ConfigurationFileLocationsManager()
|
||||
configuration_manager.load_configs(config_file_locations)
|
||||
cmd = configuration_manager.get_openstack_config().get_version_cmd()
|
||||
cmd = ConfigurationManager.get_openstack_config().get_version_cmd()
|
||||
|
||||
get_logger().log_info("Display App Version Step")
|
||||
lab_connect_keywords = LabConnectionKeywords()
|
||||
|
Reference in New Issue
Block a user