testcontainers / testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
https://testcontainers-python.readthedocs.io/en/latest/
Apache License 2.0
1.44k stars 270 forks source link

New Container: SFTP server #628

Closed oliverlambson closed 3 weeks ago

oliverlambson commented 3 weeks ago

What is the new container you'd like to have?

atmoz/sftp is a full-featured SFTP mock server that's ideal for integration testing.

It allows for configs that accept basic user/password auth and keypair auth. This covers most ways you would connect to a real SFTP server and is particularly useful for avoiding having to create a specific insecure SFTP handler for testing only—moving the mocking out of application code.

Why not just use a generic container for this?

The keypair auth support config is non-trivial, as it requires (1) generating a private key, (2) mounting the public key to the container, and (3) keeping the private key accessible in a format that can be used to connect to the server. Mounting directories (e.g. seed data) in to the server is a bit fiddly, and dealing with filesystem permissions to allow users to upload to their directories is a common gotcha with atmoz/sftp.

For an end-user, having an SFTP server that can just be spun up without understanding the internals seems ideal. If nothing else, it means you don't have to repeat the same config over and over again whenever you want to use a sftp testcontainer.

Other references:

N/A