We have integration tests and unit tests in our backend. These are done with pytest.
For example run it like this:
docker compose exec backend pytest tests/unit/ -v
Create the following structure in your backend service:
src/ft_transcendence_backend/
├── tests/
│ ├── conftest.py # pytest fixtures
│ ├── unit/ # unit tests
│ ├── integration/ # integration tests
│ └── e2e/ # end-to-end tests
To implement this:
.env.test
file for test environment variablesdocker-compose.test.yml
.github/workflows/ci-cd.yml
To run tests locally:
docker compose -f docker-compose.test.yml up --build
To add the necessary secrets to your GitHub repository, follow these steps:
Settings
tab at the top of the repository page.Secrets and variables
under the Security
section.Actions
to manage secrets for GitHub Actions.New repository secret
button.Here’s how to add a secret:
New repository secret
.DOCKERHUB_USERNAME
your-dockerhub-username
Add secret
.Repeat these steps for each of the secrets listed above.