diff --git a/embedded-aerospike/README.adoc b/embedded-aerospike/README.adoc index 658cdad28..62a39bb27 100644 --- a/embedded-aerospike/README.adoc +++ b/embedded-aerospike/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.aerospike.enabled` `(true|false, default is 'true')` +* `embedded.aerospike.reuseContainer` `(true|false, default is 'false')` * `embedded.aerospike.dockerImage` `(default is set to 'aerospike/aerospike-server:4.3.0.8')` ** You can pick wanted version on https://hub.docker.com/r/library/aerospike/tags/[dockerhub] * `embedded.aerospike.waitTimeoutInSeconds` `(default is 60 seconds)` diff --git a/embedded-aerospike/src/main/java/com/playtika/test/aerospike/EmbeddedAerospikeBootstrapConfiguration.java b/embedded-aerospike/src/main/java/com/playtika/test/aerospike/EmbeddedAerospikeBootstrapConfiguration.java index 4041772a9..f748a5a5a 100644 --- a/embedded-aerospike/src/main/java/com/playtika/test/aerospike/EmbeddedAerospikeBootstrapConfiguration.java +++ b/embedded-aerospike/src/main/java/com/playtika/test/aerospike/EmbeddedAerospikeBootstrapConfiguration.java @@ -84,6 +84,7 @@ public GenericContainer aerospike(AerospikeWaitStrategy aerospikeWaitStrategy, .withEnv("STORAGE_GB", String.valueOf(1)) .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN)) .waitingFor(waitStrategy) + .withReuse(properties.isReuseContainer()) .withStartupTimeout(properties.getTimeoutDuration()); startAndLogTime(aerospike); diff --git a/embedded-couchbase/README.adoc b/embedded-couchbase/README.adoc index 4ec99a452..f0d241371 100644 --- a/embedded-couchbase/README.adoc +++ b/embedded-couchbase/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.couchbase.enabled` `(true|false, default is 'true')` +* `embedded.couchbase.reuseContainer` `(true|false, default is 'false')` * `embedded.couchbase.services` `(comma separated list, default is 'INDEX,KV,QUERY,SEARCH')` * `embedded.couchbase.bucketRamMb` `(default is set to '100')` * `embedded.couchbase.dockerImage` `(default is set to 'couchbase/server:6.5.1')` diff --git a/embedded-couchbase/src/main/java/com/playtika/test/couchbase/EmbeddedCouchbaseBootstrapConfiguration.java b/embedded-couchbase/src/main/java/com/playtika/test/couchbase/EmbeddedCouchbaseBootstrapConfiguration.java index 9d3e9a1e7..0fdd1712b 100644 --- a/embedded-couchbase/src/main/java/com/playtika/test/couchbase/EmbeddedCouchbaseBootstrapConfiguration.java +++ b/embedded-couchbase/src/main/java/com/playtika/test/couchbase/EmbeddedCouchbaseBootstrapConfiguration.java @@ -62,6 +62,7 @@ public CouchbaseContainer couchbase(ConfigurableEnvironment environment, .withBucket(bucketDefinition) .withEnabledServices(properties.getServices()) .withCredentials(properties.getUser(), properties.getPassword()) + .withReuse(properties.isReuseContainer()) .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN)); couchbase.start(); diff --git a/embedded-dynamodb/README.adoc b/embedded-dynamodb/README.adoc index c0c442745..8ccb09c27 100644 --- a/embedded-dynamodb/README.adoc +++ b/embedded-dynamodb/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.dynamodb.enabled` `(true|false, default is 'true')` +* `embedded.dynamodb.reuseContainer` `(true|false, default is 'false')` * `embedded.dynamodb.dockerImage` `(default is set to 'amazon/dynamodb-local:latest')` ==== Produces diff --git a/embedded-dynamodb/src/main/java/com/playtika/test/dynamodb/EmbeddedDynamoDBBootstrapConfiguration.java b/embedded-dynamodb/src/main/java/com/playtika/test/dynamodb/EmbeddedDynamoDBBootstrapConfiguration.java index 08a12a261..b8b055df3 100644 --- a/embedded-dynamodb/src/main/java/com/playtika/test/dynamodb/EmbeddedDynamoDBBootstrapConfiguration.java +++ b/embedded-dynamodb/src/main/java/com/playtika/test/dynamodb/EmbeddedDynamoDBBootstrapConfiguration.java @@ -59,6 +59,7 @@ public GenericContainer dynamoDb(ConfigurableEnvironment environment, .withLogConsumer(containerLogsConsumer(log)) .withExposedPorts(properties.port) .waitingFor(new HostPortWaitStrategy()) + .withReuse(properties.isReuseContainer()) .withStartupTimeout(properties.getTimeoutDuration()); container.start(); diff --git a/embedded-elasticsearch/README.adoc b/embedded-elasticsearch/README.adoc index a9d5e367e..22111fb7d 100644 --- a/embedded-elasticsearch/README.adoc +++ b/embedded-elasticsearch/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.elasticsearch.enabled` `(true|false, default is 'true')` +* `embedded.elasticsearch.reuseContainer` `(true|false, default is 'false')` * `embedded.elasticsearch.dockerImage` `(default is set to 'elasticsearch:7.7.0')` * `embedded.elasticsearch.indices` `(indices to create, no indices are created by default)` ** You can pick wanted version on https://www.docker.elastic.co[docker.elastic.co] diff --git a/embedded-elasticsearch/src/main/java/com/playtika/test/elasticsearch/ElasticSearchContainerFactory.java b/embedded-elasticsearch/src/main/java/com/playtika/test/elasticsearch/ElasticSearchContainerFactory.java index c4e1c84d2..8ee778114 100644 --- a/embedded-elasticsearch/src/main/java/com/playtika/test/elasticsearch/ElasticSearchContainerFactory.java +++ b/embedded-elasticsearch/src/main/java/com/playtika/test/elasticsearch/ElasticSearchContainerFactory.java @@ -47,6 +47,7 @@ static ElasticsearchContainer create(ElasticSearchProperties properties, Logger .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN)) .withLogConsumer(containerLogsConsumer(containerLogger)) .waitingFor(getCompositeWaitStrategy(properties)) + .withReuse(properties.isReuseContainer()) .withStartupTimeout(properties.getTimeoutDuration()); } diff --git a/embedded-google-pubsub/README.adoc b/embedded-google-pubsub/README.adoc index ace4321e8..a26d05690 100644 --- a/embedded-google-pubsub/README.adoc +++ b/embedded-google-pubsub/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.google.pubsub.enabled` `(true|false, default is 'true')` +* `embedded.google.pubsub.reuseContainer` `(true|false, default is 'false')` * `embedded.google.pubsub.dockerImage` `(default is set to 'google/cloud-sdk:257.0.0')` ** You can pick wanted version on https://hub.docker.com/r/google/cloud-sdk/[dockerhub] * `embedded.google.pubsub.host` `(default is 0.0.0.0)` diff --git a/embedded-google-pubsub/src/main/java/com/playtika/test/pubsub/EmbeddedPubsubBootstrapConfiguration.java b/embedded-google-pubsub/src/main/java/com/playtika/test/pubsub/EmbeddedPubsubBootstrapConfiguration.java index 3a136919a..a1ac3423a 100644 --- a/embedded-google-pubsub/src/main/java/com/playtika/test/pubsub/EmbeddedPubsubBootstrapConfiguration.java +++ b/embedded-google-pubsub/src/main/java/com/playtika/test/pubsub/EmbeddedPubsubBootstrapConfiguration.java @@ -75,6 +75,7 @@ public GenericContainer pubsub(ConfigurableEnvironment environment, ) ) .waitingFor(new LogMessageWaitStrategy().withRegEx("(?s).*started.*$")) + .withReuse(properties.isReuseContainer()) .withStartupTimeout(properties.getTimeoutDuration()); container.start(); diff --git a/embedded-influxdb/README.adoc b/embedded-influxdb/README.adoc index 01945c795..8c76f411b 100644 --- a/embedded-influxdb/README.adoc +++ b/embedded-influxdb/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.influxdb.enabled` `(boolean, true|false, default is 'true')` +* `embedded.influxdb.reuseContainer` `(boolean, true|false, default is 'false')` * `embedded.influxdb.dockerImage` `(String, default is set to 'influxdb:1.5-alpine')` ** You can pick wanted version on dockerhub * `embedded.influxdb.admin-user` `(String, default is 'admin')` diff --git a/embedded-influxdb/src/main/java/com/playtika/test/influxdb/EmbeddedInfluxDBBootstrapConfiguration.java b/embedded-influxdb/src/main/java/com/playtika/test/influxdb/EmbeddedInfluxDBBootstrapConfiguration.java index 00c4d1b90..c5f0c5c32 100644 --- a/embedded-influxdb/src/main/java/com/playtika/test/influxdb/EmbeddedInfluxDBBootstrapConfiguration.java +++ b/embedded-influxdb/src/main/java/com/playtika/test/influxdb/EmbeddedInfluxDBBootstrapConfiguration.java @@ -64,6 +64,7 @@ public ConcreteInfluxDbContainer influxdb(ConfigurableEnvironment environment, .withDatabase(properties.getDatabase()) .withExposedPorts(properties.getPort()) .withLogConsumer(containerLogsConsumer(log)) + .withReuse(properties.isReuseContainer()) .withStartupTimeout(properties.getTimeoutDuration()); influxDBContainer.waitingFor(getInfluxWaitStrategy(properties.getUser(), properties.getPassword())); diff --git a/embedded-keycloak/README.adoc b/embedded-keycloak/README.adoc index c4ab35584..43d4b7c83 100644 --- a/embedded-keycloak/README.adoc +++ b/embedded-keycloak/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.keycloak.enabled` `(boolean, true|false, default is 'true')` +* `embedded.keycloak.reuseContainer` `(boolean, true|false, default is 'false')` * `embedded.keycloak.dockerImage` `(String, default is set to 'jboss/keycloak:8.0.1')` ** You can pick wanted version on dockerhub. * `embedded.keycloak.command` `(String[], default is '["-c", "standalone.xml", "-Dkeycloak.profile.feature.upload_scripts=enabled"]')` diff --git a/embedded-keycloak/src/main/java/com/playtika/test/keycloak/KeycloakContainerFactory.java b/embedded-keycloak/src/main/java/com/playtika/test/keycloak/KeycloakContainerFactory.java index bc584ebdc..5e0459312 100644 --- a/embedded-keycloak/src/main/java/com/playtika/test/keycloak/KeycloakContainerFactory.java +++ b/embedded-keycloak/src/main/java/com/playtika/test/keycloak/KeycloakContainerFactory.java @@ -25,7 +25,8 @@ public class KeycloakContainerFactory { public KeycloakContainer newKeycloakContainer() { log.info("Starting Keycloak server. Docker image: {}", properties.getDockerImage()); - KeycloakContainer keycloak = new KeycloakContainer(properties, resourceLoader); + KeycloakContainer keycloak = new KeycloakContainer(properties, resourceLoader) + .withReuse(properties.isReuseContainer()); keycloak.start(); registerKeycloakEnvironment(keycloak); diff --git a/embedded-localstack/README.adoc b/embedded-localstack/README.adoc index 4c4730cab..991312fb9 100644 --- a/embedded-localstack/README.adoc +++ b/embedded-localstack/README.adoc @@ -14,6 +14,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.localstack.enabled` `(true|false, default is 'true')` +* `embedded.localstack.reuseContainer` `(true|false, default is 'false')` * `embedded.localstack.services` `(comma separated list of AWS services (S3, SQS, DYNAMODB, etc. Should be non empty)` ** You can choose available services on localstack * `embedded.localstack.defaultRegion` `(default is 'us-east-1')` diff --git a/embedded-localstack/src/main/java/com/playtika/test/localstack/EmbeddedLocalStackBootstrapConfiguration.java b/embedded-localstack/src/main/java/com/playtika/test/localstack/EmbeddedLocalStackBootstrapConfiguration.java index 813f7c3a8..e51541d29 100644 --- a/embedded-localstack/src/main/java/com/playtika/test/localstack/EmbeddedLocalStackBootstrapConfiguration.java +++ b/embedded-localstack/src/main/java/com/playtika/test/localstack/EmbeddedLocalStackBootstrapConfiguration.java @@ -35,7 +35,8 @@ public EmbeddedLocalStackContainer localStack(ConfigurableEnvironment environmen .withEnv("DEFAULT_REGION", properties.getDefaultRegion()) .withEnv("HOSTNAME", properties.getHostname()) .withEnv("HOSTNAME_EXTERNAL", properties.getHostnameExternal()) - .withEnv("USE_SSL", String.valueOf(properties.isUseSsl())); + .withEnv("USE_SSL", String.valueOf(properties.isUseSsl())) + .withReuse(properties.isReuseContainer()); for (LocalStackContainer.Service service : properties.services) { localStackContainer.withServices(service); diff --git a/embedded-mariadb/README.adoc b/embedded-mariadb/README.adoc index 06e0a7209..dc3466161 100644 --- a/embedded-mariadb/README.adoc +++ b/embedded-mariadb/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.mariadb.enabled` `(true|false, default is 'true')` +* `embedded.mariadb.reuseContainer` `(true|false, default is 'false')` * `embedded.mariadb.encoding` `(default is 'utf8mb4')` * `embedded.mariadb.collation` `(default is 'utf8mb4_unicode_ci')` * `embedded.mariadb.dockerImage` `(default is set to 'mariadb:10.3.2')` diff --git a/embedded-mariadb/src/main/java/com/playtika/test/mariadb/EmbeddedMariaDBBootstrapConfiguration.java b/embedded-mariadb/src/main/java/com/playtika/test/mariadb/EmbeddedMariaDBBootstrapConfiguration.java index 87d6e08bf..4faf3f541 100644 --- a/embedded-mariadb/src/main/java/com/playtika/test/mariadb/EmbeddedMariaDBBootstrapConfiguration.java +++ b/embedded-mariadb/src/main/java/com/playtika/test/mariadb/EmbeddedMariaDBBootstrapConfiguration.java @@ -68,7 +68,8 @@ public MariaDBContainer mariadb(ConfigurableEnvironment environment, .withExposedPorts(properties.port) .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN)) .withStartupTimeout(properties.getTimeoutDuration()) - .withInitScript(properties.initScriptPath); + .withInitScript(properties.initScriptPath) + .withReuse(properties.isReuseContainer()); startAndLogTime(mariadb); registerMariadbEnvironment(mariadb, environment, properties); return mariadb; diff --git a/embedded-memsql/README.adoc b/embedded-memsql/README.adoc index 84270a990..9476f2264 100644 --- a/embedded-memsql/README.adoc +++ b/embedded-memsql/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.memsql.enabled` `(true|false, default is 'true')` +* `embedded.memsql.reuseContainer` `(true|false, default is 'false')` * `embedded.memsql.dockerImage` `(default is set to 'memsql/quickstart:minimal-6.0.8')` ** You can pick wanted version on https://hub.docker.com/r/memsql/quickstart/tags/[dockerhub] * `embedded.memsql.waitTimeoutInSeconds` `(default is 60 seconds)` diff --git a/embedded-memsql/src/main/java/com/playtika/test/memsql/EmbeddedMemSqlBootstrapConfiguration.java b/embedded-memsql/src/main/java/com/playtika/test/memsql/EmbeddedMemSqlBootstrapConfiguration.java index aa2a267e4..a35995980 100644 --- a/embedded-memsql/src/main/java/com/playtika/test/memsql/EmbeddedMemSqlBootstrapConfiguration.java +++ b/embedded-memsql/src/main/java/com/playtika/test/memsql/EmbeddedMemSqlBootstrapConfiguration.java @@ -70,7 +70,8 @@ public GenericContainer memsql(ConfigurableEnvironment environment, .withCopyFileToContainer(MountableFile.forClasspathResource("mem.sql"), "/schema.sql") .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN)) .waitingFor(memSqlStatusCheck) - .withStartupTimeout(properties.getTimeoutDuration()); + .withStartupTimeout(properties.getTimeoutDuration()) + .withReuse(properties.isReuseContainer()); memsql.start(); registerMemSqlEnvironment(memsql, environment, properties); return memsql; diff --git a/embedded-minio/README.adoc b/embedded-minio/README.adoc index 578097587..08d682752 100644 --- a/embedded-minio/README.adoc +++ b/embedded-minio/README.adoc @@ -14,6 +14,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.minio.enabled` `(true|false, default is 'true')` +* `embedded.minio.reuseContainer` `(true|false, default is 'false')` * `embedded.minio.dockerImage` `(default is set to 'minio/minio')` ** You can pick wanted version on https://hub.docker.com/r/minio/minio/tags[dockerhub] * `embedded.minio.accessKey` `(default is set to 'AKIAIOSFODNN7EXAMPLE")` diff --git a/embedded-minio/src/main/java/com/playtika/test/minio/EmbeddedMinioBootstrapConfiguration.java b/embedded-minio/src/main/java/com/playtika/test/minio/EmbeddedMinioBootstrapConfiguration.java index 720b4e9cb..0881ea4c3 100644 --- a/embedded-minio/src/main/java/com/playtika/test/minio/EmbeddedMinioBootstrapConfiguration.java +++ b/embedded-minio/src/main/java/com/playtika/test/minio/EmbeddedMinioBootstrapConfiguration.java @@ -83,7 +83,8 @@ public GenericContainer minio(MinioWaitStrategy minioWaitStrategy, .withCommand("server", properties.directory) .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN)) .waitingFor(minioWaitStrategy) - .withStartupTimeout(properties.getTimeoutDuration()); + .withStartupTimeout(properties.getTimeoutDuration()) + .withReuse(properties.isReuseContainer()); startAndLogTime(minio); registerEnvironment(minio, environment, properties); diff --git a/embedded-mongodb/README.adoc b/embedded-mongodb/README.adoc index aea1d3919..d6291f256 100644 --- a/embedded-mongodb/README.adoc +++ b/embedded-mongodb/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.mongodb.enabled` `(true|false, default is 'true')` +* `embedded.mongodb.reuseContainer` `(true|false, default is 'false')` * `embedded.mongodb.dockerImage` `(default is set to 'mongo:4.2.0-bionic')` ** You can pick wanted version on https://hub.docker.com/_/mongo?tab=tags[dockerhub] * `embedded.mongodb.host` `(default is localhost)` diff --git a/embedded-mongodb/src/main/java/com/playtika/test/mongodb/EmbeddedMongodbBootstrapConfiguration.java b/embedded-mongodb/src/main/java/com/playtika/test/mongodb/EmbeddedMongodbBootstrapConfiguration.java index 88bbee3d7..71c06bef2 100644 --- a/embedded-mongodb/src/main/java/com/playtika/test/mongodb/EmbeddedMongodbBootstrapConfiguration.java +++ b/embedded-mongodb/src/main/java/com/playtika/test/mongodb/EmbeddedMongodbBootstrapConfiguration.java @@ -67,7 +67,8 @@ public GenericContainer mongodb( .withExposedPorts(properties.getPort()) .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN)) .waitingFor(mongodbStatusCheck) - .withStartupTimeout(properties.getTimeoutDuration()); + .withStartupTimeout(properties.getTimeoutDuration()) + .withReuse(properties.isReuseContainer()); mongodb.start(); registerMongodbEnvironment(mongodb, environment, properties); diff --git a/embedded-mysql/README.adoc b/embedded-mysql/README.adoc index 929293436..9ff699e2f 100644 --- a/embedded-mysql/README.adoc +++ b/embedded-mysql/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.mysql.enabled` `(true|false, default is 'true')` +* `embedded.mysql.reuseContainer` `(true|false, default is 'false')` * `embedded.mysql.encoding` `(default is 'utf8mb4')` * `embedded.mysql.collation` `(default is 'utf8mb4_unicode_ci')` * `embedded.mysql.dockerImage` `(default is set to 'mysql:5.7.22')` diff --git a/embedded-mysql/src/main/java/com/playtika/test/mysql/EmbeddedMySQLBootstrapConfiguration.java b/embedded-mysql/src/main/java/com/playtika/test/mysql/EmbeddedMySQLBootstrapConfiguration.java index ee0df2281..dd9562cb7 100644 --- a/embedded-mysql/src/main/java/com/playtika/test/mysql/EmbeddedMySQLBootstrapConfiguration.java +++ b/embedded-mysql/src/main/java/com/playtika/test/mysql/EmbeddedMySQLBootstrapConfiguration.java @@ -67,7 +67,8 @@ public MySQLContainer mysql(ConfigurableEnvironment environment, .withExposedPorts(properties.port) .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN)) .withStartupTimeout(properties.getTimeoutDuration()) - .withInitScript(properties.initScriptPath); + .withInitScript(properties.initScriptPath) + .withReuse(properties.isReuseContainer()); startAndLogTime(mysql); registerMySQLEnvironment(mysql, environment, properties); return mysql; diff --git a/embedded-neo4j/README.adoc b/embedded-neo4j/README.adoc index f6abcd689..5e71af928 100644 --- a/embedded-neo4j/README.adoc +++ b/embedded-neo4j/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.neo4j.enabled` `(true|false, default is 'true')` +* `embedded.neo4j.reuseContainer` `(true|false, default is 'false')` * `embedded.neo4j.dockerImage` `(default is set to 'neo4j:3.2.7')` ** You can pick wanted version on https://hub.docker.com/r/library/neo4j/tags/[dockerhub] * `embedded.neo4j.waitTimeoutInSeconds` `(default is 60 seconds)` diff --git a/embedded-neo4j/src/main/java/com/playtika/test/neo4j/EmbeddedNeo4jBootstrapConfiguration.java b/embedded-neo4j/src/main/java/com/playtika/test/neo4j/EmbeddedNeo4jBootstrapConfiguration.java index fabbf9b9f..9ee754f15 100644 --- a/embedded-neo4j/src/main/java/com/playtika/test/neo4j/EmbeddedNeo4jBootstrapConfiguration.java +++ b/embedded-neo4j/src/main/java/com/playtika/test/neo4j/EmbeddedNeo4jBootstrapConfiguration.java @@ -60,7 +60,8 @@ public Neo4jContainer neo4j(ConfigurableEnvironment environment, .withAdminPassword(properties.password) .withLogConsumer(containerLogsConsumer(log)) .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN)) - .withStartupTimeout(properties.getTimeoutDuration()); + .withStartupTimeout(properties.getTimeoutDuration()) + .withReuse(properties.isReuseContainer()); neo4j.start(); registerNeo4jEnvironment(neo4j, environment, properties); return neo4j; diff --git a/embedded-oracle-xe/README.adoc b/embedded-oracle-xe/README.adoc index dfddc72b3..19b042d2b 100644 --- a/embedded-oracle-xe/README.adoc +++ b/embedded-oracle-xe/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.oracle.enabled` `(boolean, true|false, default is 'true')` +* `embedded.oracle.reuseContainer` `(boolean, true|false, default is 'false')` * `embedded.oracle.waitTimeoutInSeconds` `(default is 60 seconds)` * `embedded.oracle.dockerImage` `(String, default is set to 'oracleinanutshell/oracle-xe-11g')` ** You can pick wanted image on https://hub.docker.com/search?q=oracle-xe&type=image[dockerhub] diff --git a/embedded-oracle-xe/src/main/java/com/playtika/test/oracle/EmbeddedOracleBootstrapConfiguration.java b/embedded-oracle-xe/src/main/java/com/playtika/test/oracle/EmbeddedOracleBootstrapConfiguration.java index 5a1863834..b3f1679c4 100644 --- a/embedded-oracle-xe/src/main/java/com/playtika/test/oracle/EmbeddedOracleBootstrapConfiguration.java +++ b/embedded-oracle-xe/src/main/java/com/playtika/test/oracle/EmbeddedOracleBootstrapConfiguration.java @@ -61,7 +61,8 @@ public OracleContainer oracle(ConfigurableEnvironment environment, .withPassword(properties.getPassword()) .withLogConsumer(containerLogsConsumer(log)) .withStartupTimeout(properties.getTimeoutDuration()) - .withInitScript(properties.initScriptPath); + .withInitScript(properties.initScriptPath) + .withReuse(properties.isReuseContainer()); oracle.start(); registerOracleEnvironment(oracle, environment, properties); return oracle; diff --git a/embedded-postgresql/README.adoc b/embedded-postgresql/README.adoc index 642c52610..bedcd4eee 100644 --- a/embedded-postgresql/README.adoc +++ b/embedded-postgresql/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.postgresql.enabled` `(true|false, default is 'true')` +* `embedded.postgresql.reuseContainer` `(true|false, default is 'false')` * `embedded.postgresql.dockerImage` `(default is set to 'postgres:9.6.8')` ** You can pick wanted version on https://hub.docker.com/r/library/postgres/tags/[dockerhub] * `embedded.postgresql.waitTimeoutInSeconds` `(default is 60 seconds)` diff --git a/embedded-postgresql/src/main/java/com/playtika/test/postgresql/EmbeddedPostgreSQLBootstrapConfiguration.java b/embedded-postgresql/src/main/java/com/playtika/test/postgresql/EmbeddedPostgreSQLBootstrapConfiguration.java index 9bcf4ffad..51ea1c8f3 100644 --- a/embedded-postgresql/src/main/java/com/playtika/test/postgresql/EmbeddedPostgreSQLBootstrapConfiguration.java +++ b/embedded-postgresql/src/main/java/com/playtika/test/postgresql/EmbeddedPostgreSQLBootstrapConfiguration.java @@ -60,7 +60,8 @@ public ConcretePostgreSQLContainer postgresql(ConfigurableEnvironment environmen .withDatabaseName(properties.getDatabase()) .withLogConsumer(containerLogsConsumer(log)) .withStartupTimeout(properties.getTimeoutDuration()) - .withInitScript(properties.initScriptPath); + .withInitScript(properties.initScriptPath) + .withReuse(properties.isReuseContainer()); postgresql.start(); registerPostgresqlEnvironment(postgresql, environment, properties); return postgresql; diff --git a/embedded-rabbitmq/README.adoc b/embedded-rabbitmq/README.adoc index c56a8d123..68c78ea75 100644 --- a/embedded-rabbitmq/README.adoc +++ b/embedded-rabbitmq/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.rabbitmq.enabled` `(true|false, default is 'true')` +* `embedded.rabbitmq.reuseContainer` `(true|false, default is 'false')` * `embedded.rabbitmq.password` `(default : rabbitmq)` * `embedded.rabbitmq.vhost` `(virtual host, default: '/')` * `embedded.rabbitmq.dockerImage` `(default: rabbitmq/3-management)` diff --git a/embedded-rabbitmq/src/main/java/com/playtika/test/rabbitmq/EmbeddedRabbitMQBootstrapConfiguration.java b/embedded-rabbitmq/src/main/java/com/playtika/test/rabbitmq/EmbeddedRabbitMQBootstrapConfiguration.java index 38eeb81b1..05aa0345f 100644 --- a/embedded-rabbitmq/src/main/java/com/playtika/test/rabbitmq/EmbeddedRabbitMQBootstrapConfiguration.java +++ b/embedded-rabbitmq/src/main/java/com/playtika/test/rabbitmq/EmbeddedRabbitMQBootstrapConfiguration.java @@ -60,7 +60,8 @@ public RabbitMQContainer rabbitmq( .withEnv("RABBITMQ_DEFAULT_VHOST", properties.getVhost()) .withLogConsumer(containerLogsConsumer(log)) .withExposedPorts(properties.getPort()) - .withStartupTimeout(properties.getTimeoutDuration()); + .withStartupTimeout(properties.getTimeoutDuration()) + .withReuse(properties.isReuseContainer()); rabbitMQ.start(); registerRabbitMQEnvironment(rabbitMQ, environment, properties); return rabbitMQ; diff --git a/embedded-redis/README.adoc b/embedded-redis/README.adoc index 253df1374..c1a873a3a 100644 --- a/embedded-redis/README.adoc +++ b/embedded-redis/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.redis.enabled` `(true|false, default is 'true')` +* `embedded.redis.reuseContainer` `(true|false, default is 'false')` * `embedded.redis.dockerImage` `(default is set to 'redis:4.0.12')` ** You can pick wanted version on https://hub.docker.com/r/library/redis/tags/[dockerhub] * `embedded.redis.waitTimeoutInSeconds` `(default is 60 seconds)` diff --git a/embedded-redis/src/main/java/com/playtika/test/redis/EmbeddedRedisBootstrapConfiguration.java b/embedded-redis/src/main/java/com/playtika/test/redis/EmbeddedRedisBootstrapConfiguration.java index 4701ed0e3..9374a2b8e 100644 --- a/embedded-redis/src/main/java/com/playtika/test/redis/EmbeddedRedisBootstrapConfiguration.java +++ b/embedded-redis/src/main/java/com/playtika/test/redis/EmbeddedRedisBootstrapConfiguration.java @@ -105,7 +105,8 @@ public GenericContainer redis(ConfigurableEnvironment environment, .withCopyFileToContainer(MountableFile.forClasspathResource("nodes.conf"), "/data/nodes.conf") .withCommand("redis-server", "/data/redis.conf") .waitingFor(redisStartupCheckStrategy) - .withStartupTimeout(properties.getTimeoutDuration()); + .withStartupTimeout(properties.getTimeoutDuration()) + .withReuse(properties.isReuseContainer()); startAndLogTime(redis); Map redisEnv = registerRedisEnvironment(environment, redis, properties, properties.port); log.info("Started Redis cluster. Connection details: {}", redisEnv); diff --git a/embedded-vault/README.adoc b/embedded-vault/README.adoc index eb0aea259..c3a44017b 100644 --- a/embedded-vault/README.adoc +++ b/embedded-vault/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.vault.enabled` `(boolean, true|false, default is 'true')` +* `embedded.vault.reuseContainer` `(boolean, true|false, default is 'false')` * `embedded.vault.dockerImage` `(String, default is set to 'vault:1.4.0')` ** You can pick wanted version on dockerhub * `embedded.vault.host` `(String, default is 'localhost')` diff --git a/embedded-vault/src/main/java/com/playtika/test/vault/EmbeddedVaultBootstrapConfiguration.java b/embedded-vault/src/main/java/com/playtika/test/vault/EmbeddedVaultBootstrapConfiguration.java index f1fc36367..54ddf2202 100644 --- a/embedded-vault/src/main/java/com/playtika/test/vault/EmbeddedVaultBootstrapConfiguration.java +++ b/embedded-vault/src/main/java/com/playtika/test/vault/EmbeddedVaultBootstrapConfiguration.java @@ -63,7 +63,8 @@ public VaultContainer vault(ConfigurableEnvironment environment, VaultProperties .withVaultToken(properties.getToken()) .withLogConsumer(containerLogsConsumer(log)) .withExposedPorts(properties.getPort()) - .withStartupTimeout(properties.getTimeoutDuration()); + .withStartupTimeout(properties.getTimeoutDuration()) + .withReuse(properties.isReuseContainer()); String[] secrets = properties.getSecrets().entrySet().stream() .map(entry -> String.format("%s=%s", entry.getKey(), entry.getValue())) diff --git a/embedded-voltdb/README.adoc b/embedded-voltdb/README.adoc index 9a8840cac..4ee8586de 100644 --- a/embedded-voltdb/README.adoc +++ b/embedded-voltdb/README.adoc @@ -15,6 +15,7 @@ ==== Consumes (via `bootstrap.properties`) * `embedded.voltdb.enabled` `(true|false, default is 'true')` +* `embedded.voltdb.reuseContainer` `(true|false, default is 'false')` * `embedded.voltdb.dockerImage` `(default is set to 'voltdb/voltdb-community:8.3.3')` ** You can pick wanted version on https://hub.docker.com/r/voltdb/voltdb-community/tags/[dockerhub] diff --git a/embedded-voltdb/src/main/java/com/playtika/test/voltdb/EmbeddedVoltDBBootstrapConfiguration.java b/embedded-voltdb/src/main/java/com/playtika/test/voltdb/EmbeddedVoltDBBootstrapConfiguration.java index 4e6ebe04d..9c6e1ae0c 100644 --- a/embedded-voltdb/src/main/java/com/playtika/test/voltdb/EmbeddedVoltDBBootstrapConfiguration.java +++ b/embedded-voltdb/src/main/java/com/playtika/test/voltdb/EmbeddedVoltDBBootstrapConfiguration.java @@ -67,7 +67,8 @@ public GenericContainer voltDB(ConfigurableEnvironment environment, .withLogConsumer(containerLogsConsumer(log)) .withExposedPorts(properties.port) .waitingFor(voltDbStatusCheck) - .withStartupTimeout(properties.getTimeoutDuration()); + .withStartupTimeout(properties.getTimeoutDuration()) + .withReuse(properties.isReuseContainer()); voltDB.start(); registerVoltDBEnvironment(voltDB, environment, properties); return voltDB; diff --git a/testcontainers-common/src/main/java/com/playtika/test/common/properties/CommonContainerProperties.java b/testcontainers-common/src/main/java/com/playtika/test/common/properties/CommonContainerProperties.java index bde55510c..8d98f936b 100644 --- a/testcontainers-common/src/main/java/com/playtika/test/common/properties/CommonContainerProperties.java +++ b/testcontainers-common/src/main/java/com/playtika/test/common/properties/CommonContainerProperties.java @@ -32,6 +32,7 @@ public class CommonContainerProperties { private long waitTimeoutInSeconds = 60; private boolean enabled = true; + private boolean reuseContainer = false; public Duration getTimeoutDuration() { return Duration.ofSeconds(waitTimeoutInSeconds);