From 62b5702a79f412c30659bb99e625a34571ba06b8 Mon Sep 17 00:00:00 2001 From: akuker <34318535+akuker@users.noreply.github.com> Date: Tue, 27 Jul 2021 18:40:00 -0500 Subject: [PATCH] Create new test cases for checking that the user can specify the TCP Port number (#154) * Add keywords to support rasctl port testing * Rascsi service should be restarted at the end of the test, not started Co-authored-by: akuker --- test/robot/Resources/rascsi_utils.resource | 32 +++++++++++++++++++++ test/robot/rasctl_options.robot | 33 ++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 test/robot/rasctl_options.robot diff --git a/test/robot/Resources/rascsi_utils.resource b/test/robot/Resources/rascsi_utils.resource index 9e12261d..26d68627 100644 --- a/test/robot/Resources/rascsi_utils.resource +++ b/test/robot/Resources/rascsi_utils.resource @@ -122,3 +122,35 @@ Get checksum of ${filename} from ISO ${image_name} on the RaSCSI Host Execute Command rm -rf /tmp/${temp_dirname} sudo=True sudo_password=${Rascsi_Password} [Return] ${checksum} +The RaSCSI service is configured to use port ${port_number} + [Documentation] Modifies the rascsi.service systemd configuration file to use the specified port + ... instead of the default. This will erase any other options that have been previously + ... set in your rascsi.service file. + Execute command sed -i 's/^ExecStart=.*/ExecStart=\\\/usr\\\/local\\\/bin\\\/rascsi -p ${port_number}/' /etc/systemd/system/rascsi.service sudo=True sudo_password=${Rascsi_Password} + Execute command systemctl daemon-reload sudo=True sudo_password=${Rascsi_Password} + ${service_file}= Execute command cat /etc/systemd/system/rascsi.service + log ${service_file} + +The RaSCSI service is configured to use default port + [Documentation] Restore the rascsi.service systemd configuration file to use the default rascsi + ... launch command + Execute command sed -i 's/^ExecStart=.*/ExecStart=\\\/usr\\\/local\\\/bin\\\/rascsi/' /etc/systemd/system/rascsi.service sudo=True sudo_password=${Rascsi_Password} + Execute command systemctl daemon-reload sudo=True sudo_password=${Rascsi_Password} + ${service_file}= Execute command cat /etc/systemd/system/rascsi.service + log ${service_file} + +RASCTL should connect on port ${port_number} + ${stdout_out} ${stderr_out}= Execute Command rasctl -l -p ${port_number} return_stderr=True + log ${stdout_out} + log ${stderr_out} + Should Contain ${stdout_out} No images currently attached + +RASCTL should not connect on port ${port_number} + ${stdout_out} ${stderr_out}= Execute Command rasctl -l -p ${port_number} return_stderr=True + log ${stdout_out} + log ${stderr_out} + Should Contain ${stderr_out} Error: Can't connect to rascsi process on host + +Kill all rascsi processes + ${result}= Execute command killall -9 rascsi sudo=True sudo_password=${Rascsi_Password} + log ${result} \ No newline at end of file diff --git a/test/robot/rasctl_options.robot b/test/robot/rasctl_options.robot new file mode 100644 index 00000000..6df7bbe6 --- /dev/null +++ b/test/robot/rasctl_options.robot @@ -0,0 +1,33 @@ +*** Settings *** +Documentation Test that the RaSCSI can be started on a configurable TCP port. +Library OperatingSystem +Resource Resources/rascsi_utils.resource +Resource Resources/linux_services.resource + +Suite Setup Open Connection to Rascsi and Log In +Suite Teardown Close All Connections + +*** Test Cases *** +RASCTL Works on the Default Port + [Documentation] Check that RaSCSI starts with the default port + [Teardown] Run Keywords Kill all rascsi processes The Rascsi service is Restarted + When The RaSCSI service is configured to use default port + And The RaSCSI service is Restarted + Then rasctl should connect on port 6868 + And rasctl should not connect on port 9999 + +RASCTL Works on User Specified Port 9999 + [Documentation] Check that RaSCSI works with a user specified port "9999" + [Teardown] Run Keywords The RaSCSI service is configured to use default port The Rascsi service is Restarted + When The RaSCSI service is configured to use port 9999 + And The RaSCSI service is Restarted + Then rasctl should connect on port 9999 + And rasctl should not connect on port 6868 + +RASCTL Works on User Specified Port 6869 + [Documentation] Check that RaSCSI works with a user specified port DEFAULT + 1 + [Teardown] Run Keywords The RaSCSI service is configured to use default port The Rascsi service is Restarted + When The RaSCSI service is configured to use port 6869 + And The RaSCSI service is Restarted + Then rasctl should connect on port 6869 + And rasctl should not connect on port 6868