Back to Testcontainers Java

Hashicorp Consul Module

docs/modules/consul.md

2.0.51.3 KB
Original Source

Hashicorp Consul Module

Testcontainers module for Consul. Consul is a tool for managing key value properties. More information on Consul here.

Usage example

<!--codeinclude-->

Running Consul in your Junit tests

<!--/codeinclude-->

Why Consul in Junit tests?

With the increasing popularity of Consul and config externalization, applications are now needing to source properties from Consul. This can prove challenging in the development phase without a running Consul instance readily on hand. This library aims to solve your apps integration testing with Consul. You can also use it to test how your application behaves with Consul by writing different test scenarios in Junit.

Adding this module to your project dependencies

Add the following dependency to your pom.xml/build.gradle file:

=== "Gradle" groovy testImplementation "org.testcontainers:testcontainers-consul:{{latest_version}}"

=== "Maven" xml <dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers-consul</artifactId> <version>{{latest_version}}</version> <scope>test</scope> </dependency>