Skip to content

Commit

Permalink
Bump testcontainers-bom from 1.16.0 to 1.16.1 (#7019)
Browse files Browse the repository at this point in the history
* Bump testcontainers-bom from 1.16.0 to 1.16.1

Bumps [testcontainers-bom](https://github.com/testcontainers/testcontainers-java) from 1.16.0 to 1.16.1.
- [Release notes](https://github.com/testcontainers/testcontainers-java/releases)
- [Changelog](https://github.com/testcontainers/testcontainers-java/blob/master/CHANGELOG.md)
- [Commits](testcontainers/testcontainers-java@1.16.0...1.16.1)

---
updated-dependencies:
- dependency-name: org.testcontainers:testcontainers-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

* use mongodb testcontainer module and upgrade a bit mongodb version
* give it more time to start
* use mongo image from test container api for distribution test
* create only once
* use a different wait strategy based on log rather than port as hazelcast try to do some broadcastind
* change wait for strategy

Co-authored-by: Olivier Lamy <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
  • Loading branch information
dependabot[bot] and olamy authored Oct 22, 2021
1 parent cdf03fe commit d4ee8d5
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 30 deletions.
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<maven.version>3.8.2</maven.version>
<maven-artifact-transfer.version>0.13.1</maven-artifact-transfer.version>
<maven.resolver.version>1.7.2</maven.resolver.version>
<mongodb.version>2.13.2</mongodb.version>
<mongodb.version>3.2.2</mongodb.version>
<openpojo.version>0.9.1</openpojo.version>
<org.osgi.annotation.version>8.0.1</org.osgi.annotation.version>
<org.osgi.core.version>6.0.0</org.osgi.core.version>
Expand All @@ -115,7 +115,7 @@
<springboot.version>2.1.1.RELEASE</springboot.version>
<taglibs-standard-impl.version>1.2.5</taglibs-standard-impl.version>
<taglibs-standard-spec.version>1.2.5</taglibs-standard-spec.version>
<testcontainers.version>1.16.0</testcontainers.version>
<testcontainers.version>1.16.1</testcontainers.version>
<xmemcached.version>2.4.7</xmemcached.version>
<weld.version>3.1.8.Final</weld.version>

Expand Down Expand Up @@ -169,6 +169,8 @@
<jetty.surefire.argLine>-Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US -showversion -Xmx4g -Xms2g -Xlog:gc:stderr:time,level,tags</jetty.surefire.argLine>
<jetty.testtracker.log>false</jetty.testtracker.log>
<jetty.unixdomain.dir>/tmp</jetty.unixdomain.dir>
<!-- if changing this version please update default in MongoTestHelper you will get thanks from Eclipse IDE users -->
<mongo.docker.version>3.2.20</mongo.docker.version>
<settingsPath>src/it/settings.xml</settingsPath>
<surefire.rerunFailingTestsCount>0</surefire.rerunFailingTestsCount>
</properties>
Expand Down
5 changes: 5 additions & 0 deletions tests/test-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@
<artifactId>gcloud</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mongodb</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
Expand All @@ -30,13 +31,10 @@
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.tests.distribution.JettyHomeTester;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
Expand All @@ -53,24 +51,21 @@ public class HazelcastSessionDistributionTests extends AbstractSessionDistributi

private static final Logger LOGGER = LoggerFactory.getLogger(HazelcastSessionDistributionTests.class);

private GenericContainer<?> hazelcast;

private Path hazelcastJettyPath;

@BeforeEach
public void setupHazelcast()
{
hazelcast = new GenericContainer<>("hazelcast/hazelcast:" + System.getProperty("hazelcast.version", "4.1"))
private GenericContainer<?> hazelcast = new GenericContainer<>("hazelcast/hazelcast:" + System.getProperty("hazelcast.version", "4.2.2"))
.withExposedPorts(5701)
.waitingFor(Wait.forListeningPort())
.waitingFor(Wait.forLogMessage(".*is STARTED.*", 1))
//.waitingFor(Wait.forListeningPort().withStartupTimeout(Duration.ofSeconds(120L)))
.withLogConsumer(new Slf4jLogConsumer(HAZELCAST_LOG));
}

private Path hazelcastJettyPath;

@Override
public void startExternalSessionStorage() throws Exception
{
hazelcast.start();

if (!hazelcast.isRunning())
{
hazelcast.start();
}
String hazelcastHost = hazelcast.getContainerIpAddress();
int hazelcastPort = hazelcast.getMappedPort(5701);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.MongoDBContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
import org.testcontainers.utility.DockerImageName;

/**
*
Expand All @@ -35,11 +37,12 @@ public class MongodbSessionDistributionTests extends AbstractSessionDistribution

private static final int MONGO_PORT = 27017;

final String imageName = "mongo:" + System.getProperty("mongo.docker.version", "2.2.7");
final GenericContainer mongoDBContainer =
new GenericContainer(imageName)
.withLogConsumer(new Slf4jLogConsumer(MONGO_LOG))
.withExposedPorts(MONGO_PORT);
final String imageName = "mongo:" + System.getProperty("mongo.docker.version", "3.2.20");

final MongoDBContainer mongoDBContainer =
new MongoDBContainer(DockerImageName.parse(imageName))
.withLogConsumer(new Slf4jLogConsumer(MONGO_LOG));

private String host;
private int port;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
import org.testcontainers.containers.wait.strategy.Wait;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -69,8 +70,7 @@ public class RemoteInfinispanTestSupport
.withEnv("PASS", "foobar")
.withEnv("MGMT_USER", "admin")
.withEnv("MGMT_PASS", "admin")
.waitingFor(new LogMessageWaitStrategy()
.withRegEx(".*Infinispan Server.*started in.*\\s"))
.waitingFor(Wait.forLogMessage(".*Infinispan Server.*started in.*\\s", 1))
.withExposedPorts(4712, 4713, 8088, 8089, 8443, 9990, 9993, 11211, 11222, 11223, 11224)
.withLogConsumer(new Slf4jLogConsumer(INFINISPAN_LOG));
infinispan.start();
Expand Down
7 changes: 5 additions & 2 deletions tests/test-sessions/test-mongodb-sessions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
<properties>
<bundle-symbolic-name>${project.groupId}.sessions.mongo</bundle-symbolic-name>
<embedmongo.host>localhost</embedmongo.host>
<!-- if changing this version please update default in MongoTestHelper you will get thanks from Eclipse IDE users -->
<mongo.docker.version>2.2.7</mongo.docker.version>
</properties>
<build>
<plugins>
Expand Down Expand Up @@ -118,6 +116,11 @@
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mongodb</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.MongoDBContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
import org.testcontainers.utility.DockerImageName;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand All @@ -50,10 +52,9 @@ public class MongoTestHelper

private static final int MONGO_PORT = 27017;

static GenericContainer mongo =
new GenericContainer("mongo:" + System.getProperty("mongo.docker.version", "2.2.7"))
.withLogConsumer(new Slf4jLogConsumer(MONGO_LOG))
.withExposedPorts(MONGO_PORT);
static MongoDBContainer mongo =
new MongoDBContainer(DockerImageName.parse("mongo:" + System.getProperty("mongo.docker.version", "3.2.20")))
.withLogConsumer(new Slf4jLogConsumer(MONGO_LOG));

static MongoClient mongoClient;

Expand Down

0 comments on commit d4ee8d5

Please sign in to comment.