forked from testcontainers/testcontainers-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update BrowserWebDriverContainer to honor existing no_proxy setting
- Loading branch information
1 parent
3ee82e9
commit 4ed091b
Showing
2 changed files
with
39 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
34 changes: 34 additions & 0 deletions
34
modules/selenium/src/test/java/org/testcontainers/junit/BrowserWebDriverContainerTest.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,34 @@ | ||
package org.testcontainers.junit; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.openqa.selenium.remote.DesiredCapabilities; | ||
import org.testcontainers.containers.BrowserWebDriverContainer; | ||
|
||
import static org.rnorth.visibleassertions.VisibleAssertions.assertEquals; | ||
|
||
public class BrowserWebDriverContainerTest { | ||
|
||
private static final String NO_PROXY_VALUE = "localhost,.noproxy-domain.com"; | ||
|
||
@Rule | ||
public BrowserWebDriverContainer chromeWithNoProxySet = (BrowserWebDriverContainer) new BrowserWebDriverContainer() | ||
.withDesiredCapabilities(DesiredCapabilities.chrome()) | ||
.withEnv("no_proxy", NO_PROXY_VALUE); | ||
|
||
@Rule | ||
public BrowserWebDriverContainer chromeWithoutNoProxySet = new BrowserWebDriverContainer() | ||
.withDesiredCapabilities(DesiredCapabilities.chrome()); | ||
|
||
@Test | ||
public void honorPresetNoProxyEnvironment() { | ||
Object no_proxy = chromeWithNoProxySet.getEnvMap().get("no_proxy"); | ||
assertEquals("no_proxy should be preserved by the container rule", NO_PROXY_VALUE, no_proxy); | ||
} | ||
|
||
@Test | ||
public void provideDefaultNoProxyEnvironmentIfNotSet() { | ||
Object no_proxy = chromeWithoutNoProxySet.getEnvMap().get("no_proxy"); | ||
assertEquals("no_proxy should be set to default if not already present", "localhost", no_proxy); | ||
} | ||
} |