Trying to fix test failures caused by Testcontainers running in Docker on Jenkins. The Cassandra Docker image/container is forked inside Docker running in Jenkins CI and is currently throwing:
Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (172.17.0.1 ports: [49401] should be listening)
at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:49)
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:892)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:440)
... 85 more
In the Testcontainers project, I found:
https://github.com/testcontainers/testcontainers-java/issues/4360
And specifically:
https://github.com/testcontainers/testcontainers-java/issues/4360#issuecomment-892481828
The Jenkins servers (worker nodes) were recently upgraded to:
docker-ce (5:20.10.8~3-0~ubuntu-bionic)
containerd.io (1.4.9-1)
The new 'configureEnvironment(:Environment) method attempts to add a custom PropertySource to the Environment if the Environment is configurable, otherwise proceeds in setting a Java System Property as before.
The idea is, the Environment is more recycable than Java System Properties, particularly if the Spring ApplicationContext is refreshed.
Renames DEFAULT_CLUSTER_CONDITION_MATCH to DEFAULT_CLUSTER_AWARE_CONDITION_MATCH.
Renames DEFAULT_CLUSTER_CONDITION_STRICT_MATCH to DEFAULT_CLUSTER_AWARE_CONDITION_STRICT_MATCH.
Test and assert client Region DataPolicy configuration (PROXY).
Test and assert Environment configuration does not set the 'spring.data.gemfire.cache.client.region.shortcut' property.
Add preconditions for a Kubernetes runtime environment and logging set to INFO.
Test and assert client Region DataPolicy configuration (PROXY).
Test and assert Environment configuration does not set the 'spring.data.gemfire.cache.client.region.shortcut' property.
Add precoditions for a CloudFoundry runtime environment and logging not set to INFO.
Remove all logging from the overridden matches(..) method.
Override the configureTopology(..) method to do nothing.
Override the logConnectedRuntimeEnvironment(..) and logUnconnectedRuntimeEnvironment(..) to log appropriate messages for cloud runtime environments.
Refactor the StandaloneClusterAvailableCondition match to only act when not in a cloud runtime envrionment.
Remove logging from configureTopology(..) and add call to logRuntimeEnvironmet(..) from doMatch(..).
Add ClusterAwareCondition.set(:Boolean) class method to allow Condition subclasses to set the clusterAvailable state; refactor reset() to call set(null).
Edit Javadoc.
Using 'strictMatch' enables fail-fast behavior so that users can configure their Spring Boot, Apache Geode ClientCache applications to fail on startup if no cluster is available across any environment.
Additionally, enhanced the log output to give users better information about the runtime environment and whether an Apache Geode-based cluster was found and available.
Resolves gh-99.