Skip to content
This repository was archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
test: avoid using port 8180
Browse files Browse the repository at this point in the history
While using the docker-compose workflow, port 8180 is likely to be in
use by the local KeyCloak.
  • Loading branch information
Dominique Quatravaux committed Jun 11, 2020
1 parent 3218beb commit 290b98e
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@WebMvcTest(value = {AuthCodeGenerationController.class, OAuth2SecuredWebConfiguration.class})
@WebMvcTest(value = {AuthCodeGenerationController.class, OAuth2SecuredWebConfiguration.class},
properties="jeap.security.oauth2.resourceserver.authorization-server.jwk-set-uri=http://localhost:8182/.well-known/jwks.json") // Avoid port 8180, see below
@ActiveProfiles("local")
class AuthCodeGenerationControllerSecurityTest {

private static final String URL = "/v1/authcode";
private static final String VALID_USER_ROLE = "bag-pts-allow";
private static final String INVALID_USER_ROLE = "invalid-role";
private static final int MOCK_SERVER_PORT = 8180;
// Avoid port 8180, which is likely used by the local KeyCloak:
private static final int MOCK_SERVER_PORT = 8182;

@Autowired
private MockMvc mockMvc;
Expand All @@ -53,7 +55,9 @@ class AuthCodeGenerationControllerSecurityTest {
private static final LocalDateTime EXPIRED_IN_FUTURE = LocalDateTime.now().plusDays(1);
private static final LocalDateTime EXPIRED_IN_PAST = LocalDateTime.now().minusDays(1);

private static WireMockServer wireMockServer = new WireMockServer(options().port(MOCK_SERVER_PORT));
private static WireMockServer wireMockServer =
// new WireMockServer(options().dynamicPort());
new WireMockServer(options().port(MOCK_SERVER_PORT));

@BeforeAll
static void setup() throws Exception {
Expand Down

0 comments on commit 290b98e

Please sign in to comment.