This replies to the issue #6. It adds a tests and CI to the project that runs tests, builds and pushes the images on Docker hub.
Where are tests
Tests are stored in a nodejs Typescript project in folder <root>/tests. I used testcontainers with the nodejs lib.
For the moment there is one test. You can ask for more if needed.
How it works
If you test the CI with workflow make sure your have set the requirments in the chapter Requirements below.
The Dockerfile contained in <root>/tests/ftp-client is used to create an ftp client that can be used in all tests to make calls to the vsftpd server by extending it in other Dockerfiles and replacing its entrypoint like <root>/tests/upload/upload-docker-image/Dockerfile. The build workflow needs to also push it on dockerhub.
If you want I can use this instead.
When the command npm run tests is run, the test contained in <root>/tests/upload/upload.spec.ts uses testcontainers to run the <root>/tests/upload/upload-docker-compose.test.yml file.
This file launches two services:
vsftp : The server that we will be testing and which has a volume mounted in <root>/tests/upload/volume-files.
This service extends the generic vsftpd service contained in the <root>/tests/docker-compose.test.yml file.
upload-ftp-client: The client that will be used to upload testfile.txt on the vsftpd server.
When the uploading is done I compare the checksum of the source file used to be uploaded and the newly uploaded file in <root>/tests/upload/volume-files.
Requirements to test the workflows
To be able to test this PR, you must create an Environment (go here) named test and add following secrets
Name
Description
DOCKERHUB_CENTOS_FTP_IMAGE_REPOSITORY
The name of the repository that stores the ftp client image. example : lhauspie/centos-ftp
Description
This replies to the issue #6. It adds a tests and CI to the project that runs tests, builds and pushes the images on Docker hub.
Where are tests
Tests are stored in a nodejs Typescript project in folder
<root>/tests
. I used testcontainers with the nodejs lib. For the moment there is one test. You can ask for more if needed.How it works
If you test the CI with workflow make sure your have set the requirments in the chapter
Requirements
below.The Dockerfile contained in
<root>/tests/ftp-client
is used to create an ftp client that can be used in all tests to make calls to the vsftpd server by extending it in other Dockerfiles and replacing its entrypoint like<root>/tests/upload/upload-docker-image/Dockerfile
. The build workflow needs to also push it on dockerhub. If you want I can use this instead.When the command
npm run tests
is run, the test contained in<root>/tests/upload/upload.spec.ts
uses testcontainers to run the<root>/tests/upload/upload-docker-compose.test.yml
file.This file launches two services:
vsftp
: The server that we will be testing and which has a volume mounted in<root>/tests/upload/volume-files
. This service extends the generic vsftpd service contained in the<root>/tests/docker-compose.test.yml
file.upload-ftp-client
: The client that will be used to uploadtestfile.txt
on the vsftpd server.When the uploading is done I compare the checksum of the source file used to be uploaded and the newly uploaded file in
<root>/tests/upload/volume-files
.Requirements to test the workflows
To be able to test this PR, you must create an Environment (go here) named
test
and add following secretsDOCKERHUB_CENTOS_FTP_IMAGE_REPOSITORY
lhauspie/centos-ftp
DOCKERHUB_USERNAME
DOCKERHUB_TOKEN
DOCKERHUB_VSFTPD_IMAGE_REPOSITORY
lhauspie/vsftpd
Github action Workflows
There are two Github action workflows in the folder .github/workflows.
build-test.workflow.yml
: Builds base images and launches tests on every push on every branch.publish.workflow.yml
: When manually triggered, asks the branch and the version to publish and publishes it on Docker hub.Technologies used
This PR is considered as stable. If you want me to modify something don't hesitate.
Linked to issue #6
hacktoberfest