Automatically Skipping User Confirmation for Specific Commands in Test Framework
Some service-impacting operations in the CLI require explicit user confirmation unless overridden with the --yes flag. When no input is provided, these commands may timeout, causing test failures.
This change addresses the issue by appending --yes to such commands within the test framework to prevent confirmation prompts and avoid timeouts.
Behavior:
1. When cli_confirmations is enabled & --yes is used, commands
execute without prompts.
2. When cli_confirmations is enabled & --yes is not provided, a
confirmation prompt appears, and if no response is given, it
times out.
Test Plan:
PASS - AIO-SX:
Manually executed every command changed in ansible files and
Verified CLI behavior aligns with the above conditions.
Depends-On: https://review.opendev.org/c/starlingx/config/+/932861
Depends-On: https://review.opendev.org/c/starlingx/fault/+/932838
Depends-On: https://review.opendev.org/c/starlingx/fault/+/932837
Depends-On: https://review.opendev.org/c/starlingx/fault/+/930552
Depends-On: https://review.opendev.org/c/starlingx/fault/+/934250
Story: 2011240
Task: 52012
Change-Id: Icd8161d98b42a9f5e42560959aead71c898d88ce
Signed-off-by: Sabyasachi Nayak <sabyasachi.nayak@windriver.com>
This commit is contained in:
committed by
sabyasachi nayak
parent
a757b12805
commit
ac386f4a54
@@ -49,7 +49,7 @@ class DcmanagerPatchStrategyKeywords(BaseKeyword):
|
||||
Returns:
|
||||
DcmanagerPatchStrategyShowOutput: An object containing details of the patch strategy .
|
||||
"""
|
||||
command = source_openrc("dcmanager patch-strategy delete")
|
||||
command = source_openrc("dcmanager patch-strategy delete --yes")
|
||||
output = self.ssh_connection.send(command)
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
return DcmanagerPatchStrategyShowOutput(output)
|
||||
|
||||
@@ -25,5 +25,6 @@ class DcManagerSubcloudDeleteKeywords(BaseKeyword):
|
||||
subcloud_name (str): a str representing a subcloud's name.
|
||||
"""
|
||||
# Delete the subcloud
|
||||
self.ssh_connection.send(source_openrc(f"dcmanager subcloud delete {subcloud_name}"))
|
||||
self.ssh_connection.send(source_openrc(f"dcmanager subcloud delete
|
||||
{subcloud_name} --yes"))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
|
||||
@@ -78,7 +78,8 @@ class DcmanagerSubcloudGroupKeywords(BaseKeyword):
|
||||
Returns:
|
||||
None: This method does not return a value.
|
||||
"""
|
||||
command = source_openrc(f"dcmanager subcloud-group delete {group_name}")
|
||||
command = source_openrc(f"dcmanager subcloud-group delete {group_name}
|
||||
--yes")
|
||||
self.ssh_connection.send(command)
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ class DcManagerSubcloudUpdateKeywords(BaseKeyword):
|
||||
Returns: DcManagerSubcloudShowOutput
|
||||
|
||||
"""
|
||||
output = self.ssh_connection.send(source_openrc(f"dcmanager subcloud update {subcloud_name} --{update_attr} '{update_value}'"))
|
||||
output = self.ssh_connection.send(source_openrc(f"dcmanager subcloud
|
||||
update {subcloud_name} --{update_attr} '{update_value}' --yes"))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
dcmanager_subcloud_show_output = DcManagerSubcloudShowOutput(output)
|
||||
|
||||
|
||||
@@ -52,5 +52,6 @@ class SystemApplicationDeleteKeywords(BaseKeyword):
|
||||
if system_application_delete_input.get_force_deletion():
|
||||
force_as_param = '-f'
|
||||
|
||||
cmd = f'system application-delete {force_as_param} {system_application_delete_input.get_app_name()}'
|
||||
cmd = f'system application-delete {force_as_param}
|
||||
{system_application_delete_input.get_app_name()} --yes'
|
||||
return cmd
|
||||
|
||||
@@ -21,7 +21,8 @@ class SystemDatanetworkDeleteKeywords(BaseKeyword):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
self.ssh_connection.send(source_openrc(f'system datanetwork-delete {datanetwork_uuid}'))
|
||||
self.ssh_connection.send(source_openrc(f'system datanetwork-delete
|
||||
{datanetwork_uuid} --yes'))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
|
||||
def cleanup_datanetwork(self, datanetwork_uuid: str):
|
||||
@@ -33,7 +34,8 @@ class SystemDatanetworkDeleteKeywords(BaseKeyword):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
self.ssh_connection.send(source_openrc(f'system datanetwork-delete {datanetwork_uuid}'))
|
||||
self.ssh_connection.send(source_openrc(f'system datanetwork-delete
|
||||
{datanetwork_uuid} --yes'))
|
||||
rc = self.ssh_connection.get_return_code()
|
||||
if rc != 0:
|
||||
get_logger().log_error(f"datanetwork with uuid {datanetwork_uuid} failed to delete")
|
||||
|
||||
@@ -87,5 +87,6 @@ class SystemHostFSKeywords(BaseKeyword):
|
||||
|
||||
Returns: None
|
||||
"""
|
||||
self.ssh_connection.send(source_openrc(f"system host-fs-delete {hostname} {fs_name}"))
|
||||
self.ssh_connection.send(source_openrc(f"system host-fs-delete
|
||||
{hostname} {fs_name} --yes"))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
|
||||
@@ -87,7 +87,8 @@ class SystemHostInterfaceKeywords(BaseKeyword):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
self.ssh_connection.send(source_openrc(f'system host-if-delete {hostname} {interface_name}'))
|
||||
self.ssh_connection.send(source_openrc(f'system host-if-delete
|
||||
{hostname} {interface_name} --yes'))
|
||||
self.validate_success_return_code()
|
||||
|
||||
def cleanup_interface(self, hostname: str, interface_name: str):
|
||||
@@ -100,7 +101,8 @@ class SystemHostInterfaceKeywords(BaseKeyword):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
self.ssh_connection.send(source_openrc(f'system host-if-delete {hostname} {interface_name}'))
|
||||
self.ssh_connection.send(source_openrc(f'system host-if-delete
|
||||
{hostname} {interface_name} --yes'))
|
||||
rc = self.ssh_connection.get_return_code()
|
||||
if rc != 0:
|
||||
get_logger().log_error(f"interface {interface_name} failed to delete")
|
||||
|
||||
@@ -37,7 +37,8 @@ class SystemHostLockKeywords(BaseKeyword):
|
||||
KeywordException: If lock does not occur in the given amount of time
|
||||
|
||||
"""
|
||||
self.ssh_connection.send(source_openrc(f"system host-lock {host_name}"))
|
||||
self.ssh_connection.send(source_openrc(f"system host-lock {host_name}
|
||||
--yes"))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
is_host_locked = SystemHostLockKeywords(self.ssh_connection).wait_for_host_locked(host_name)
|
||||
if not is_host_locked:
|
||||
|
||||
@@ -40,7 +40,8 @@ class SystemHostRebootKeywords(BaseKeyword):
|
||||
|
||||
pre_uptime_of_host = SystemHostListKeywords(self.ssh_connection).get_uptime(host_name)
|
||||
|
||||
self.ssh_connection.send(source_openrc(f"system host-reboot {host_name}"))
|
||||
self.ssh_connection.send(source_openrc(f"system host-reboot {host_name}
|
||||
--yes"))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
|
||||
is_reboot_success = self.wait_for_reboot(host_name, pre_uptime_of_host)
|
||||
|
||||
@@ -31,7 +31,8 @@ class SystemHostSwactKeywords(BaseKeyword):
|
||||
"""
|
||||
active_controller = SystemHostListKeywords(self.ssh_connection).get_active_controller()
|
||||
standby_controller = SystemHostListKeywords(self.ssh_connection).get_standby_controller()
|
||||
self.ssh_connection.send(source_openrc(f'system host-swact {active_controller.get_host_name()}'))
|
||||
self.ssh_connection.send(source_openrc(f'system host-swact
|
||||
{active_controller.get_host_name()} --yes'))
|
||||
self.validate_success_return_code(self.ssh_connection)
|
||||
is_swact_success = self.wait_for_swact(active_controller, standby_controller)
|
||||
if not is_swact_success:
|
||||
|
||||
Reference in New Issue
Block a user