Skip to content

Add SSH server context for testing SSHDataGrabber #2480

Open
@effigies

Description

@effigies

Summary

This issue proposes a follow-up to the work @ashgillman has been doing on #2104, writing tests for SSHDataGrabber. Currently, the test is skipped if paramiko isn't installed or there is no SSH server running. Running an SSH server in containers is non-trivial, involving scripting the container from the outside (with a docker exec -u root <image> /etc/init.d/ssh start or similar). While it could be done in CI scripts, this is a bit much to expect of users and goes counter to the idea of testing in containers.

What would be ideal is to be able to spin up a short-lived server that only permits localhost connections in a context like:

with localhost_only_ssh_server(host_key) as server:
    port = server.port
    # Test code that connects to localhost:<port>

Paramiko has the ability to spin up servers, but a few quick attempts at prototyping have failed, and I haven't had time to dig in deeply. If anybody has more experience with paramiko, that would be useful.

Actual behavior

Skipping tests.

Expected behavior

Skipping tests, but would be nice not to have to.

How to replicate the behavior

Run tests in Docker image.

Execution environment

Choose one

  • Container [Tag: nipype/nipype:py36]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions