'TeamCity run pytest in a docker-compose environment

I have a question regarding a build configuration in teamcity

We are developing a python (flask) rest api where a sql database holds the data. Flask server and postgresql server each runs in a docker container. Our repository contains a docker-compose file which starts all necesary containers.

Now I want to set up a build configuration in TeamCity where the repository is pulled, containers are build and then the docker-compose file should be up and all test functions (pytest) in my flask-python application should be run. I want to get the test report and the docker-compose down command should be run.

My first approach using a command line build configuration step and issuing the commands works, but i don't get the test reports. I not even getting the correct exit code (test fails, but build configuration marked as success)

Can you give me a hint what would be the best strategie to do this task. Building, Testing, Deploying a application which is build out of multiple docker containers (i.e. a docker-compose file)

Thanks Jakob



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source