If your service is part of a micro-service 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 prerequisites 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.
Run the Integration Tests
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.
- 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