-
-
Notifications
You must be signed in to change notification settings - Fork 658
Automated Testing
FluentFTP has an extensive automated test suite that includes unit tests for modules, and integration tests which test FluentFTP against many supported FTP servers using Docker containers to locally mount and configure these servers portably.
All credits for the development of our excellent integration test system go to Tommy Sørbråten, Michael Stiemke and Robin Rodricks.
-
FluentFTP.Tests
- XUnit test suite that performs:- Unit testing - Tests FluentFTP components and algorithms in isolation.
- Integration testing - Tests all major FTP functionality against containerized FTP servers.
-
FluentFTP.Dockers
- Dockerfiles for our customized FTP servers used by the test suite. -
FluentFTP.Xunit
- Containerized FTP server management used by the test suite.
You can help! Please file an issue if you can develop or find docker images for more FTP servers!
We have an extensive automated test suite that tests FluentFTP against these servers. We use docker to locally manage containerized FTP servers that are used for testing.
The supported servers are listed below.
Note: You don't need to download these projects manually, everything you need is in the FluentFTP repo.
Server | Credits |
---|---|
VsFTPd | Created by FluentFTP team in this PR. |
Bftpd | Created by FluentFTP team in this PR. |
ProFTPD | Created by FluentFTP team in this PR. |
glFTPd | Created by FluentFTP team in this PR. |
FileZilla | Created by FluentFTP team in this PR. |
PureFTPd | https://github.com/stilliard/docker-pure-ftpd |
PyFtpdLib | https://github.com/andriykohut/docker-pyftpdlib |
- Windows 10+ Home/Pro/Enterprise/Education 64-bit (or any OS supporting Docker)
- Virtualization in your BIOS must be enabled
- Hyper-V and Containers must be enabled (Windows only)
- Visual Studio 2022+ or VS Code
- Docker Desktop
- Open Docker Desktop to make sure it is running properly on your system.
- Run the
Build.bat
orBuild.sh
script inside theFluentFTP.Dockers
folder to create the docker images. See below for tips. - Run all the tests inside the
FluentFTP.Tests
project. It will automatically start and stop the docker FTP servers as required.
How it works:
- We support a variety of FTP servers which are docker images created and published by third parties
- Each FTP server has a container class that manages it
- All container classes inherit from
DockerFtpContainer
-
DockerFtpContainer
has aBuild
method responsible for building a test container (TestcontainersContainer
) - The Build method creates the image using the configured
DockerImage
and sets the default port binding for port 21 - Each type of container can then add additional options in their
Configure
method - We then use the test container data to start a docker container using the Testcontainers library
- After running the tests we run a system command to shut down the docker container
Docker on Windows takes up a lot of space due to this issue. WSL2 virtual disks are "dynamic" .vhdx
images, which means they:
- Are allocated to a maximum size
- Are initialized with just a few kilobytes of structural data
- Grow dynamically as data is added, up to their maximum allocated size
If you're willing to wipe all of your docker data, open the Docker Desktop client, click the bug icon in the top bar, and then click Clean/Purge data.
See this stackoverflow answer for more details.
Consider using Docker Desktop (Windows) and adding the "Disk Usage" extension by Docker official and cleaning up with this:
Of course, if you are using Docker on your dev machine for other purposes than only FluentFTP testing, you will already be aware of the considerations when removing Docker data.
The docker build batch file will build all the available images. Although our self-made images have been optimised to build as fast as possible, some of the other, public images might take a while to finish - especially when loading/installing from distro/repos that are far away.
You might want to use "REM" to comment out images that you do not want to use or that you already have built. You might want to "totally rebuild" from scratch in some cases and you might want to see more explicit progress reports when building test images. Look up the possible options for docker rebuild
and the possible commands to prune or delete existing caches or images.
Read up especially on docker builder prune --all -f
and docker image prune -f
commands and perhaps include these in the build .bat
file. Why would you want to use these commands? Although Docker tries to handle caching of build steps correctly, there are (many) cases where you would fare better when "starting from scratch". It is not so easy to convince Docker to forgo its stored (cached) layers, so beware and judiciously use these commands when needed.
The builds for our self-made images contain a preliminary step that tries to identify the closest, most up to date and hi-bandwidth mirror for debian bullseye and sets that in the etc/apt/source.list
of the building step. If you have problems, disable that behaviour in the Dockerfiles.
- Auto Connection
- Auto Reconnection
- FTP(S) Connection
- FTP(S) Connection using GnuTLS
- FTPS Proxies
- Custom Servers
- Custom Commands
- v40 Migration Guide