Documentation about starting the wiremock container with SSL
There is no documentation on how to start the container and wiremock to expose a https endpoint. I have toyed with multiple configurations, including enabling debug mode but the server still exposes default 8080 port in http mode.
Looking at the code it doesn't look like HTTPS is at all supported. Writing the code to add it looks relatively simple, but the sheer amount of test code looks a bit scary to get involved with.
It seems currently there is no way to expose a mapped port for HTTPS.
The reason why using withExposedPorts does not work is simply because as part of the startup for a container, it calls configure, see here: https://github.com/testcontainers/testcontainers-java/blob/main/core/src/main/java/org/testcontainers/containers/GenericContainer.java#L331
Which calls this method: https://github.com/wiremock/wiremock-testcontainers-java/blob/main/src/main/java/org/wiremock/integrations/testcontainers/WireMockContainer.java#L372
Which then sets the withExposedPorts to 8080 and will wipe all ports that have been set by the user.
A potential hotfix - that shouldn't require much - if at all testing would be to use addExposedPorts instead of withExposedPorts which will not override any user selections.
PR created - hopefully up to standards :). Definitely a tactical fix - I think in the future it would make sense to have actual methods for configuring the HTTPS stuff but I needed to unblock myself and fix this issue. I'll come back to this in the future to see if I can create a full solution for HTTPS.
With this change you would need to still configure HTTPS using:
.withCliArg("--https-port PORT_HERE")
.withExposedPorts(PORT_HERE)
Aswell as the other CLI args you require from here: https://wiremock.org/docs/standalone/java-jar/ - Like keystore/truststore etc.
Good fix, however it would be good to provide the flexibility to override the containers default entry command. I had initially tried overriding it using withCommand() and it did not seem to start up with the supplied arguments. I will wait for the merge approval to test this. would be good to provide examples of working configurations in the documentation, for clarity's sake ;)