MarketSquare / MarketSquare/SSHLibrary
Switch session model not suited for async execution
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 167
- Forks
- 145
- PR merge metrics
- No merged PRs in 30d
Description
When using SSHLibrary together with parallel execution of keywords (e.g. AsyncLibrary), it is very easy to use the wrong connection by mistake.
Here is a short example to illustrate the issue:
```
*** Settings ***
Library SSHLibrary
Library AsyncLibrary
*** Test Cases ***
Async SSH connections
Open Connection 172.30.101.21 alias=con1
Login root toor
Open Connection 172.30.101.22 alias=con2
Login root toor
${a1} Async Run Sleep on Device con1 20
${a2} Async Run Sleep on Device con2 10
Async Get ${a1}
Async Get ${a2}
*** Keywords ***
Sleep on Device
[Arguments] ${connection} ${seconds}
Switch Connection ${connection}
Execute Command sleep ${seconds}
Execute Command ls /home/
Close Connection
```
In this case the test case seems to switch to con2 and closes it before "ls /home" can be executed in the first Async Run.
In more complex scenarios it could easyly happen, that commands are executed on the wrong device without anyone noticing.
I would propose to add an (optional?) parameter for selecting the connection to keywords like "Execute Command" and "Close Connection".
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided AsyncLibrary example, then trace how Switch Connection, Execute Command, and Close Connection select the active connection. Define the connection-selection behavior needed for parallel keywords and add coverage for the two concurrent connections; done means commands and cleanup cannot target the wrong device.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100