-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add healthcheck endpoint in waiting strategy
- Loading branch information
1 parent
3bc486c
commit f7eb089
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...g/wiremock/integrations/testcontainers/WireMockContainerWithWireMockVersionThreeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.wiremock.integrations.testcontainers; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.testcontainers.junit.jupiter.Container; | ||
import org.testcontainers.junit.jupiter.Testcontainers; | ||
import org.wiremock.integrations.testcontainers.testsupport.http.HttpResponse; | ||
import org.wiremock.integrations.testcontainers.testsupport.http.TestHttpClient; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@Testcontainers | ||
public class WireMockContainerWithWireMockVersionThreeTest | ||
{ | ||
@Container | ||
WireMockContainer wiremockServer = new WireMockContainer("wiremock/wiremock:" + WireMockContainer.WIREMOCK_HEALTH_CHECK_SUPPORT_MINIMUM_VERSION) | ||
.withMapping("hello", WireMockContainerTest.class, "hello-world.json") | ||
.withMapping("hello-resource", WireMockContainerTest.class, "hello-world-resource.json") | ||
.withFileFromResource("hello-world-resource-response.xml", WireMockContainerTest.class, | ||
"hello-world-resource-response.xml"); | ||
|
||
|
||
@ParameterizedTest | ||
@ValueSource(strings = { | ||
"hello", | ||
"/hello" | ||
}) | ||
void helloWorld(String path) throws Exception { | ||
// given | ||
String url = wiremockServer.getUrl(path); | ||
|
||
// when | ||
HttpResponse response = new TestHttpClient().get(url); | ||
|
||
// then | ||
assertThat(response.getBody()) | ||
.as("Wrong response body") | ||
.contains("Hello, world!"); | ||
} | ||
} |