Integration Testing Tool
Integration Testing tool is a lightweight service and is used to create a mock for Events publisher and consumer services in your local docker environment. This can only be used for integration testing purposes.
Note: This tool mocks events publisher and consumer services specifically for testing purposes and is not used in the production environment.
Prerequisites: Docker
How to setup:
-
Download the latest version of docker-compose file here{:target=“_blank”}. For further details, please refer to the Release Notes.
-
After downloading the file, you’ll need to follow one of the two steps outlined below to gain read access to the publisher and consumer docker images from the artifactory docker repository.
a. First option. Run the below command to authenticate the user to read the docker image. After executing, provide your email id as username and secret API key as the password.
docker login trimblecloudevents-producer-integration-docker.artifactory.trimble.toolsdocker login trimblecloudevents-consumer-integration-docker.artifactory.trimble.toolsYou can find your secret API key in the edit profile option in artifactory (here).
b. Second option. Directly provide your credentials in config.json which is located inside your docker folder. Convert your username and password separated by a colon(:) in base64 format like this
: . {"auths": {"trimblecloudevents-consumer-integration-docker.artifactory.trimble.tools":{"auth": "<USERNAME>:<PASSWORD> (converted to base 64)"},"trimblecloudevents-producer-integration-docker.artifactory.trimble.tools":{"auth": "<USERNAME>:<PASSWORD> (converted to base 64)"}}}Copy and replace the config.json file as shown in the above format.
-
After successful login to the docker repository, execute the following command to start the docker container. Run this command where your docker-compose file is located.
docker-compose -f docker-compose-2.1.0.yml up -dStarting with the 2.1.0 release, you can customize the Kafka URL for both publisher and consumer containers by specifying them in the BOOTSTRAP_URL environment variable within the docker-compose configuration. The default value is set to kafka:9092.
Example usage:docker-compose -f docker-compose-2.1.0.yml -e BOOTSTRAP_URL=kafka:9092 up -d -
To ensure that the container is started, execute the following command to verify that all 4 containers are running ( publisher, consumer, kafka, nginx )
docker ps -
To stop all the containers after integration testing is completed, execute the following command.
docker-compose -f docker-compose-2.1.0.yml down
How to use:
Integrators can use the below endpoints to publish and consume events
To publish events:
Websocket Endpoint: ws://localhost:1000 Http Endpoint: http://localhost:32000/1.0/producers/namespaces/<<namespace>>/events/<<event-name>>/<<version>>To consume events:
Websocket Endpoint: ws://localhost:1001 Http Endpoint: http://localhost:32000/1.0/consumers/namespaces/<<namespace>>/events/<<event-name>>/<<version>>For more detailed information, please refer the documentation provided here{:target=“_blank”}.
Release Notes
| Version | Changes |
|---|---|
| 1.0 | The initial testing version of the event service publisher and consumer. |
| 2.0 | Consumers can send message-level and batch-level acknowledgments while consuming the events using websocket protocol. To know more about this functionality refer here. |
| 2.1.0 | Publishers and consumers can configure their Kafka URL while running publisher and consumer test docker images. |