Jetty 9.4.x surefire 3.0.0 m5 (#5136)

* test surefire 3.0.0-M5

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>

* simplify code to avoid some timeout

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
Olivier Lamy 2020-08-12 10:27:12 +10:00 committed by GitHub
parent f73b282050
commit 12667497e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 19 deletions

View File

@ -44,7 +44,7 @@
<jpms-module-name>${bundle-symbolic-name}</jpms-module-name>
<!-- some maven plugins versions -->
<maven.surefire.version>3.0.0-M4</maven.surefire.version>
<maven.surefire.version>3.0.0-M5</maven.surefire.version>
<maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
<maven.dependency.plugin.version>3.1.1</maven.dependency.plugin.version>
<maven.resources.plugin.version>3.1.0</maven.resources.plugin.version>

View File

@ -36,6 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -53,14 +54,16 @@ public class MongoTestHelper
static GenericContainer mongo =
new GenericContainer("mongo:" + System.getProperty("mongo.docker.version", "2.2.7"))
.withLogConsumer(new Slf4jLogConsumer(MONGO_LOG));
.withLogConsumer(new Slf4jLogConsumer(MONGO_LOG))
.waitingFor(new LogMessageWaitStrategy()
.withRegEx(".*waiting for connections.*"));
static MongoClient mongoClient;
static String mongoHost;
static int mongoPort;
public static void startMongo()
static
{
try
{
@ -70,6 +73,7 @@ public class MongoTestHelper
mongoPort = mongo.getMappedPort(27017);
LOG.info("Mongo container started for {}:{} - {}ms", mongoHost, mongoPort,
System.currentTimeMillis() - start);
mongoClient = new MongoClient(mongoHost, mongoPort);
}
catch (Exception e)
{
@ -78,24 +82,8 @@ public class MongoTestHelper
}
}
public static void stopMongo()
{
mongo.stop();
mongoClient = null;
}
public static MongoClient getMongoClient() throws UnknownHostException
{
boolean restart = false;
if (mongo == null || !mongo.isRunning())
{
startMongo();
restart = true;
}
if (mongoClient == null || restart)
{
mongoClient = new MongoClient(mongoHost, mongoPort);
}
return mongoClient;
}