Opened 12 months ago

Closed 12 months ago

Last modified 10 months ago

#142 closed task (fixed)

Make container for integration tests

Reported by: schwa Owned by: schwa
Priority: minor Milestone:
Component: Test code Version: 4.0.0
Keywords: docker, podman, container, integration test Cc:

Description

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.

Change History (4)

comment:1 Changed 12 months ago by schwa

Resolution: fixed
Status: assignedclosed

I have implemented this, see browser:/test_server . You can build the image with the test_server directory as the build context. There are also the make file targets build_test_server_image and run_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.

comment:2 Changed 12 months ago by schwa

Resolution: fixed
Status: closedreopened

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 with root:root or ftptest:ftpgroup as owner/group. That is, some directories and files are owned by ftptest to make them writable after ftptest logging into the FTP server. Other directories and files are deliberately owned by root, 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 by root. I need to look more into this.
Last edited 12 months ago by schwa (previous) (diff)

comment:3 Changed 12 months ago by schwa

Resolution: fixed
Status: reopenedclosed

I revised the Dockerfile to not use ADD so that it works with Podman. Also, the canonical content is now in the ftptest directory, not in the related ftptest.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 the ftptest home directory, but the files will then be deleted in the RUN command and therefore won't be present in the final image.

comment:4 Changed 10 months ago by schwa

Milestone: 4.1.0

Milestone deleted

Note: See TracTickets for help on using tickets.