Running Commands on Remote Hosts
Running commands on remote hosts is a fundamental feature of
pytest-mh. In order to do that, it provides abstraction over remote processes
and a generic interface in the Connection class. There
are currently two implementations of this interface:
SSH connection in
SSHClient(usingpylibsshunderneath)Direct communication with containers in
ContainerClient(supports podman and docker)
This interface allows you to run commands and scripts in both blocking and
non-blocking manner. The main and generic connection to the host can be accessed
via conn attribute of the
MultihostHost class. If needed, you can establish additional
connections by instantiating one of the connection classes (for example to open
SSH connection to the host for different user).
Note
Pytest-mh main connection expects that Linux commands are run using
bash and Windows commands using powershell.
You can provide implementation for different shells by subclassing
Shell and passing this shell directly to the
constructor of the connector. However, this should only be done for extra
connections.