If your service is part of a micro-services type of application, Codefresh enables you to run your image as part of a composition, and then run your integration tests against it. There are two pre-requisites for this step:
Define a Composition
You must define a composition in the Codefresh composition module. This composition dictates how to spin up your micro-services application before running the integration tests. For more information about compositions, see Create a Composition.
Create a Composition test image, which is a Docker image with the integration test’s execution engine and scripts
You can create a service, with the git repo that contains your integration tests scripts, in Codefresh that automatically builds a Docker image with your testing framework’s execution engine. You can add the integration test scripts as commands in the Dockerfile. Alternatively, you can create the image locally, and make it available to Codefresh in your Docker registry.
Follow these steps to run the the integration test
- Select the RUN TEST WITH COMPOSITION check box.
- Select a composition to run.
- Add a Composition test image, which will be added as a new service to your composition
This is our test image, which contains the integration test code
- Specify the command that will run on the candidate service.
- the Composition test image will be added to your existing composition as a new service.
- at the moment it is not possible to control other docker-compose fields for the test image service.
If you have a more complicated scenario, you can use the Codefresh YAML to define your pipeline