You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Testcontainers currently supports network access to the underlying host by forwarding to ports specified by Testcontainers.exposeHostPorts. If the container is configured with host access (withHostAccess(true)), then an additional host entry is added with a hostname host.testcontainers.internal and IP address corresponding to the port forwarding container at startup.
We would like the ability to define custom host aliases in addition to the default host.testcontainers.internal option.
Use Case
We are using Testcontainers for integration testing single sign-on login flows in which Selenium browser WebDriver containers interact with the application under test (AUT). In this scenario, the user is redirected to different identity providers based upon the request hostname. Backchannel requests from the AUT to the identity providers are running outside of the Docker network while front channel requests in Selenium run inside the Docker network. This requires a lot of brittle/nasty reverse proxy / DNS server configuration we'd like to avoid. We would prefer not to run the AUT in Docker.
I had a similar trouble when doing Integration test with oAuth2 front channel flows with a (Remote)Webdriver.
My solution in the end was to tweak my test setup in order to support:
a) run everything (browser, app, postgres db and keycloak/oAuthServer) inside a docker container or
b) run only browser and app on host machine (outside docker container) and the rest inside docker container
Option a) is more ci friendly (gitlab server or jenkins or what ever) and option b) is more dev friendly (on local machine)
Module
Core
Proposal
Summary
Testcontainers currently supports network access to the underlying host by forwarding to ports specified by
Testcontainers.exposeHostPorts
. If the container is configured with host access (withHostAccess(true)
), then an additional host entry is added with a hostnamehost.testcontainers.internal
and IP address corresponding to the port forwarding container at startup.We would like the ability to define custom host aliases in addition to the default
host.testcontainers.internal
option.Use Case
We are using Testcontainers for integration testing single sign-on login flows in which Selenium browser WebDriver containers interact with the application under test (AUT). In this scenario, the user is redirected to different identity providers based upon the request hostname. Backchannel requests from the AUT to the identity providers are running outside of the Docker network while front channel requests in Selenium run inside the Docker network. This requires a lot of brittle/nasty reverse proxy / DNS server configuration we'd like to avoid. We would prefer not to run the AUT in Docker.
Implementation
PortForwardingContainer.java
Testcontainers.java
GenericContainer.java
Usage
The text was updated successfully, but these errors were encountered: