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 <akuker@gmail.com>
This commit is contained in:
akuker 2021-07-27 18:40:00 -05:00 committed by GitHub
parent 18633a748c
commit 62b5702a79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 0 deletions

View File

@ -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}

View File

@ -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