-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(test): Support a changing environment for the MockClientServer in…
…jection I.e. if the devservice is temporarily deactivated, delete the instance and do not try to inject it. If the hostname and or port have changed, recreate the client with new coordinates. Fixes #177
- Loading branch information
1 parent
2e90c0c
commit 4fb0c61
Showing
3 changed files
with
56 additions
and
3 deletions.
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
35 changes: 35 additions & 0 deletions
35
...ase/src/test/java/io/quarkiverse/mockserver/it/base/TestNotUsingMockServerDevService.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,35 @@ | ||
package io.quarkiverse.mockserver.it.base; | ||
|
||
import static io.restassured.RestAssured.given; | ||
|
||
import java.util.Map; | ||
|
||
import jakarta.ws.rs.core.MediaType; | ||
import jakarta.ws.rs.core.Response; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.junit.QuarkusTestProfile; | ||
import io.quarkus.test.junit.TestProfile; | ||
|
||
@QuarkusTest | ||
@TestProfile(TestNotUsingMockServerDevService.TestProfile.class) | ||
public class TestNotUsingMockServerDevService { | ||
@Test | ||
public void test200() { | ||
given() | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.get("/test/3") | ||
.prettyPeek() | ||
.then() | ||
.statusCode(Response.Status.OK.getStatusCode()); | ||
} | ||
|
||
public static class TestProfile implements QuarkusTestProfile { | ||
@Override | ||
public Map<String, String> getConfigOverrides() { | ||
return Map.of("quarkus.mockserver.devservices.enabled", "false"); | ||
} | ||
} | ||
} |
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