For years, the tests in test/test_real_ftp.py
have run against an FTP
server that I have installed locally on my system. The tests therefore
aren't really usable for anyone else, especially since the tests not
only need a configured server, but also test data.
It would be nice to create an OCI container image so that others (and me!) can install the server and test data quickly and run tests against the container.
I have implemented this, see test_server . You can build the image with the
test_server
directory as the build context. There are also the make file targetsbuild_test_server_image
andrun_test_server
.An image is also currently on the Docker hub, but again, you can build it yourself if you have cloned/pulled the ftputil source.
The implementation works, but has problems I'd like to solve:
- When building the image with Docker, the
ADD
command in the Dockerfile correctly unpacks the tar.gz file withroot:root
orftptest:ftpgroup
as owner/group. That is, some directories and files are owned byftptest
to make them writable afterftptest
logging into the FTP server. Other directories and files are deliberately owned byroot
, so that tests can assert that the user can't write to them.However, due to a bug in some Podman versions the owner/group information isn't set correctly when unpacking the archive via
podman build
.I'd like to change the Dockerfile so that the tar.gz file is copied into the image and then unpacked in a
RUN
command. This is supposed to work around the Podman problem.
- At the moment, the tar.gz file is present as an artifact in the version control repository. However, that's not the "canonical form"; the tar.gz file is difficult to change. With the current state of the repository, users can clone the repository, build the image and run the tests, - but it's very cumbersome to change directories or files in the archive if necessary for a new or changed test. The least I'd like to do, if feasible, is to split the archive in a subdirectory that's owned by
ftptest
and one subdirectory owned byroot
. I need to look more into this.
I revised the Dockerfile to not use
ADD
so that it works with Podman. Also, the canonical content is now in theftptest
directory, not in the relatedftptest.tar.gz
file. Actually, the archive file is no longer used.One downside of this approach is that presumably empty directories under the
ftptest
directory need a dummy file.empty
, so that the directories can be represented in version control. The.empty
files will be copied into the image, together the rest of theftptest
home directory, but the files will then be deleted in theRUN
command and therefore won't be present in the final image.
Milestone deleted