Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate "environment" and "classpath" properties (for global things) (…
…#1784) * Separate "environment" and "classpath" properties (for global things) * Update TestcontainersConfiguration.java
- Loading branch information
Showing
3 changed files
with
99 additions
and
59 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
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
43 changes: 43 additions & 0 deletions
43
core/src/test/java/org/testcontainers/utility/TestcontainersConfigurationTest.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,43 @@ | ||
package org.testcontainers.utility; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.Properties; | ||
import java.util.UUID; | ||
|
||
import static org.rnorth.visibleassertions.VisibleAssertions.assertEquals; | ||
import static org.rnorth.visibleassertions.VisibleAssertions.assertFalse; | ||
import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue; | ||
|
||
public class TestcontainersConfigurationTest { | ||
|
||
final Properties environmentProperties = new Properties(); | ||
|
||
final Properties classpathProperties = new Properties(); | ||
|
||
@Test | ||
public void shouldReadChecksFromEnvironmentOnly() { | ||
assertFalse("checks enabled by default", newConfig().isDisableChecks()); | ||
|
||
classpathProperties.setProperty("checks.disable", "true"); | ||
assertFalse("checks are not affected by classpath properties", newConfig().isDisableChecks()); | ||
|
||
environmentProperties.setProperty("checks.disable", "true"); | ||
assertTrue("checks disabled", newConfig().isDisableChecks()); | ||
} | ||
|
||
@Test | ||
public void shouldReadDockerClientStrategyFromEnvironmentOnly() { | ||
String currentValue = newConfig().getDockerClientStrategyClassName(); | ||
|
||
classpathProperties.setProperty("docker.client.strategy", UUID.randomUUID().toString()); | ||
assertEquals("Docker client strategy is not affected by classpath properties", currentValue, newConfig().getDockerClientStrategyClassName()); | ||
|
||
environmentProperties.setProperty("docker.client.strategy", "foo"); | ||
assertEquals("Docker client strategy is changed", "foo", newConfig().getDockerClientStrategyClassName()); | ||
} | ||
|
||
private TestcontainersConfiguration newConfig() { | ||
return new TestcontainersConfiguration(environmentProperties, classpathProperties); | ||
} | ||
} |