From 0dda941285501c906680154c6336f29c49912d69 Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Fri, 31 Jan 2020 10:42:48 +0200 Subject: [PATCH 01/45] Add functionality to retrieve container by its name --- .../containers/DockerComposeContainer.java | 23 +++++++++++++++++-- .../junit/DockerComposeContainerTest.java | 19 ++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java b/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java index 7dec6399b8..257af64564 100644 --- a/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java +++ b/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java @@ -22,7 +22,14 @@ import org.testcontainers.containers.wait.strategy.WaitAllStrategy; import org.testcontainers.containers.wait.strategy.WaitStrategy; import org.testcontainers.lifecycle.Startable; -import org.testcontainers.utility.*; +import org.testcontainers.utility.AuditLogger; +import org.testcontainers.utility.Base58; +import org.testcontainers.utility.CommandLine; +import org.testcontainers.utility.DockerLoggerFactory; +import org.testcontainers.utility.LogUtils; +import org.testcontainers.utility.MountableFile; +import org.testcontainers.utility.ResourceReaper; +import org.testcontainers.utility.TestcontainersConfiguration; import org.zeroturnaround.exec.InvalidExitValueException; import org.zeroturnaround.exec.ProcessExecutor; import org.zeroturnaround.exec.stream.slf4j.Slf4jStream; @@ -30,7 +37,15 @@ import java.io.File; import java.time.Duration; import java.util.AbstractMap.SimpleEntry; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -479,6 +494,10 @@ public SELF withRemoveImages(RemoveImages removeImages) { return self(); } + public Optional getServiceContainerByName(String serviceName) { + return Optional.ofNullable(serviceInstanceMap.get(serviceName)); + } + private void followLogs(String containerId, Consumer consumer) { LogUtils.followOutput(DockerClientFactory.instance().client(), containerId, consumer); } diff --git a/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java b/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java index bf69656ac0..e23f87bffe 100644 --- a/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java +++ b/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java @@ -6,8 +6,11 @@ import java.io.File; +import static java.lang.String.format; import static org.rnorth.visibleassertions.VisibleAssertions.assertEquals; +import static org.rnorth.visibleassertions.VisibleAssertions.assertFalse; import static org.rnorth.visibleassertions.VisibleAssertions.assertNotNull; +import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue; /** * Created by rnorth on 08/08/2015. @@ -16,9 +19,8 @@ public class DockerComposeContainerTest extends BaseDockerComposeTest { @Rule public DockerComposeContainer environment = new DockerComposeContainer(new File("src/test/resources/compose-test.yml")) - .withExposedService("redis_1", REDIS_PORT) - .withExposedService("db_1", 3306) - ; + .withExposedService("redis_1", REDIS_PORT) + .withExposedService("db_1", 3306); @Override protected DockerComposeContainer getEnvironment() { @@ -33,4 +35,15 @@ public void testGetServicePort() { assertNotNull("Port is set for service with instance number", serviceWithoutInstancePort); assertEquals("Service ports are the same", serviceWithInstancePort, serviceWithoutInstancePort); } + + @Test + public void testGetContainerByServiceName() { + String existingServiceName = "db_1"; + assertTrue(format("Container should be found by service name %s", existingServiceName), + environment.getServiceContainerByName(existingServiceName).isPresent()); + + String notExistingServiceName = "db_256"; + assertFalse(format("No container found under service name %s", notExistingServiceName), + environment.getServiceContainerByName(notExistingServiceName).isPresent()); + } } From 543218b16dbc8238dc155c93e630d90057d841dd Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Fri, 31 Jan 2020 11:19:03 +0200 Subject: [PATCH 02/45] Fix test message --- .../org/testcontainers/junit/DockerComposeContainerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java b/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java index e23f87bffe..6bec912cd0 100644 --- a/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java +++ b/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java @@ -43,7 +43,7 @@ public void testGetContainerByServiceName() { environment.getServiceContainerByName(existingServiceName).isPresent()); String notExistingServiceName = "db_256"; - assertFalse(format("No container found under service name %s", notExistingServiceName), + assertFalse(format("No container should be found under service name %s", notExistingServiceName), environment.getServiceContainerByName(notExistingServiceName).isPresent()); } } From 7c341e1f6610ddfc40203f1d079cd23ab9c71b25 Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Fri, 31 Jan 2020 15:19:18 +0200 Subject: [PATCH 03/45] Split up negative and positive tests, additional check added --- .../junit/DockerComposeContainerTest.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java b/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java index 6bec912cd0..dc7b5501f1 100644 --- a/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java +++ b/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java @@ -2,11 +2,14 @@ import org.junit.Rule; import org.junit.Test; +import org.testcontainers.containers.ContainerState; import org.testcontainers.containers.DockerComposeContainer; import java.io.File; +import java.util.Optional; import static java.lang.String.format; +import static java.util.Collections.singletonList; import static org.rnorth.visibleassertions.VisibleAssertions.assertEquals; import static org.rnorth.visibleassertions.VisibleAssertions.assertFalse; import static org.rnorth.visibleassertions.VisibleAssertions.assertNotNull; @@ -37,13 +40,17 @@ public void testGetServicePort() { } @Test - public void testGetContainerByServiceName() { + public void shouldRetrieveContainerByServiceName() { String existingServiceName = "db_1"; - assertTrue(format("Container should be found by service name %s", existingServiceName), - environment.getServiceContainerByName(existingServiceName).isPresent()); + Optional result = environment.getServiceContainerByName(existingServiceName); + assertTrue(format("Container should be found by service name %s", existingServiceName), result.isPresent()); + assertEquals("Mapped port for result container was wrong", result.get().getExposedPorts(), singletonList(3306)); + } + @Test + public void shouldReturnEmptyResultOnNoneExistingService() { String notExistingServiceName = "db_256"; - assertFalse(format("No container should be found under service name %s", notExistingServiceName), - environment.getServiceContainerByName(notExistingServiceName).isPresent()); + Optional result = environment.getServiceContainerByName(notExistingServiceName); + assertFalse(format("No container should be found under service name %s", notExistingServiceName), result.isPresent()); } } From e097aae25432c161f5e2db8d79fe5722a4abc867 Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Fri, 31 Jan 2020 15:22:23 +0200 Subject: [PATCH 04/45] Small adjustments --- .../org/testcontainers/junit/DockerComposeContainerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java b/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java index dc7b5501f1..8d0507715a 100644 --- a/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java +++ b/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java @@ -44,7 +44,7 @@ public void shouldRetrieveContainerByServiceName() { String existingServiceName = "db_1"; Optional result = environment.getServiceContainerByName(existingServiceName); assertTrue(format("Container should be found by service name %s", existingServiceName), result.isPresent()); - assertEquals("Mapped port for result container was wrong", result.get().getExposedPorts(), singletonList(3306)); + assertEquals("Mapped port for result container was wrong, probably wrong container found", result.get().getExposedPorts(), singletonList(3306)); } @Test From aa065dc97abd99ac39fa6bd821abbb96dd82946d Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Mon, 3 Feb 2020 08:27:52 +0200 Subject: [PATCH 05/45] Renaming to better method name --- .../org/testcontainers/containers/DockerComposeContainer.java | 2 +- .../org/testcontainers/junit/DockerComposeContainerTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java b/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java index 257af64564..839db7c89d 100644 --- a/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java +++ b/core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java @@ -494,7 +494,7 @@ public SELF withRemoveImages(RemoveImages removeImages) { return self(); } - public Optional getServiceContainerByName(String serviceName) { + public Optional getContainerByServiceName(String serviceName) { return Optional.ofNullable(serviceInstanceMap.get(serviceName)); } diff --git a/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java b/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java index 8d0507715a..53d9087233 100644 --- a/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java +++ b/core/src/test/java/org/testcontainers/junit/DockerComposeContainerTest.java @@ -42,7 +42,7 @@ public void testGetServicePort() { @Test public void shouldRetrieveContainerByServiceName() { String existingServiceName = "db_1"; - Optional result = environment.getServiceContainerByName(existingServiceName); + Optional result = environment.getContainerByServiceName(existingServiceName); assertTrue(format("Container should be found by service name %s", existingServiceName), result.isPresent()); assertEquals("Mapped port for result container was wrong, probably wrong container found", result.get().getExposedPorts(), singletonList(3306)); } @@ -50,7 +50,7 @@ public void shouldRetrieveContainerByServiceName() { @Test public void shouldReturnEmptyResultOnNoneExistingService() { String notExistingServiceName = "db_256"; - Optional result = environment.getServiceContainerByName(notExistingServiceName); + Optional result = environment.getContainerByServiceName(notExistingServiceName); assertFalse(format("No container should be found under service name %s", notExistingServiceName), result.isPresent()); } } From 1ff69cef0d8d9f7ad1ded17ab839faca7ebd5501 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 17:34:35 +0000 Subject: [PATCH 06/45] Bump assertj-core from 3.14.0 to 3.15.0 in /modules/database-commons (#2307) Bumps [assertj-core](https://github.com/joel-costigliola/assertj-core) from 3.14.0 to 3.15.0. - [Release notes](https://github.com/joel-costigliola/assertj-core/releases) - [Commits](https://github.com/joel-costigliola/assertj-core/compare/assertj-core-3.14.0...assertj-core-3.15.0) Signed-off-by: dependabot-preview[bot] --- modules/database-commons/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database-commons/build.gradle b/modules/database-commons/build.gradle index ea3e0b0736..d8738a6cb6 100644 --- a/modules/database-commons/build.gradle +++ b/modules/database-commons/build.gradle @@ -3,5 +3,5 @@ description = "Testcontainers :: Database-Commons" dependencies { compile project(':testcontainers') - testCompile 'org.assertj:assertj-core:3.14.0' + testCompile 'org.assertj:assertj-core:3.15.0' } From d31d2aab01af749b0ad62f51fdd6e395e5dbe159 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 17:34:57 +0000 Subject: [PATCH 07/45] Bump assertj-core from 3.14.0 to 3.15.0 in /modules/neo4j (#2306) Bumps [assertj-core](https://github.com/joel-costigliola/assertj-core) from 3.14.0 to 3.15.0. - [Release notes](https://github.com/joel-costigliola/assertj-core/releases) - [Commits](https://github.com/joel-costigliola/assertj-core/compare/assertj-core-3.14.0...assertj-core-3.15.0) Signed-off-by: dependabot-preview[bot] --- modules/neo4j/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/neo4j/build.gradle b/modules/neo4j/build.gradle index 00e1e36f8b..9361824fdd 100644 --- a/modules/neo4j/build.gradle +++ b/modules/neo4j/build.gradle @@ -30,5 +30,5 @@ dependencies { compile project(":testcontainers") testCompile "org.neo4j.driver:neo4j-java-driver:1.7.5" - testCompile 'org.assertj:assertj-core:3.14.0' + testCompile 'org.assertj:assertj-core:3.15.0' } From 081bd044375e769cfb28e55cf78d259e19dbb081 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 17:35:38 +0000 Subject: [PATCH 08/45] Bump assertj-core from 3.14.0 to 3.15.0 in /modules/pulsar (#2305) Bumps [assertj-core](https://github.com/joel-costigliola/assertj-core) from 3.14.0 to 3.15.0. - [Release notes](https://github.com/joel-costigliola/assertj-core/releases) - [Commits](https://github.com/joel-costigliola/assertj-core/compare/assertj-core-3.14.0...assertj-core-3.15.0) Signed-off-by: dependabot-preview[bot] --- modules/pulsar/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/pulsar/build.gradle b/modules/pulsar/build.gradle index 81be68579d..88d783fc22 100644 --- a/modules/pulsar/build.gradle +++ b/modules/pulsar/build.gradle @@ -4,5 +4,5 @@ dependencies { compile project(':testcontainers') testCompile group: 'org.apache.pulsar', name: 'pulsar-client', version: '2.5.0' - testCompile group: 'org.assertj', name: 'assertj-core', version: '3.14.0' + testCompile group: 'org.assertj', name: 'assertj-core', version: '3.15.0' } From 20c8dc32e0827e99360c17ac9860afdf0c54bab5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 17:36:18 +0000 Subject: [PATCH 09/45] Bump assertj-core from 3.14.0 to 3.15.0 in /modules/vault (#2304) Bumps [assertj-core](https://github.com/joel-costigliola/assertj-core) from 3.14.0 to 3.15.0. - [Release notes](https://github.com/joel-costigliola/assertj-core/releases) - [Commits](https://github.com/joel-costigliola/assertj-core/compare/assertj-core-3.14.0...assertj-core-3.15.0) Signed-off-by: dependabot-preview[bot] --- modules/vault/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/vault/build.gradle b/modules/vault/build.gradle index ac72d306a5..1c8a4083b9 100644 --- a/modules/vault/build.gradle +++ b/modules/vault/build.gradle @@ -5,6 +5,6 @@ dependencies { testCompile 'com.bettercloud:vault-java-driver:5.1.0' testCompile 'io.rest-assured:rest-assured:4.2.0' - testCompile 'org.assertj:assertj-core:3.14.0' + testCompile 'org.assertj:assertj-core:3.15.0' } From aee4febd19535a0750337160949579599799b9ad Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 17:36:43 +0000 Subject: [PATCH 10/45] Bump assertj-core from 3.14.0 to 3.15.0 in /modules/kafka (#2303) Bumps [assertj-core](https://github.com/joel-costigliola/assertj-core) from 3.14.0 to 3.15.0. - [Release notes](https://github.com/joel-costigliola/assertj-core/releases) - [Commits](https://github.com/joel-costigliola/assertj-core/compare/assertj-core-3.14.0...assertj-core-3.15.0) Signed-off-by: dependabot-preview[bot] --- modules/kafka/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/kafka/build.gradle b/modules/kafka/build.gradle index d064e46c1d..3960cd96b6 100644 --- a/modules/kafka/build.gradle +++ b/modules/kafka/build.gradle @@ -4,6 +4,6 @@ dependencies { compile project(':testcontainers') testCompile 'org.apache.kafka:kafka-clients:2.4.0' - testCompile 'org.assertj:assertj-core:3.14.0' + testCompile 'org.assertj:assertj-core:3.15.0' testCompile 'com.google.guava:guava:23.0' } From f59da6358978d50e10d569e4a344f424671205f6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 17:36:51 +0000 Subject: [PATCH 11/45] Bump assertj-core from 3.14.0 to 3.15.0 in /core (#2308) Bumps [assertj-core](https://github.com/joel-costigliola/assertj-core) from 3.14.0 to 3.15.0. - [Release notes](https://github.com/joel-costigliola/assertj-core/releases) - [Commits](https://github.com/joel-costigliola/assertj-core/compare/assertj-core-3.14.0...assertj-core-3.15.0) Signed-off-by: dependabot-preview[bot] --- core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/build.gradle b/core/build.gradle index d7d9c581c1..25aaa396a6 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -115,7 +115,7 @@ dependencies { // Synthetic JAR used for MountableFileTest and DirectoryTarResourceTest testCompile files('testlib/repo/fakejar/fakejar/0/fakejar-0.jar') - testCompile 'org.assertj:assertj-core:3.14.0' + testCompile 'org.assertj:assertj-core:3.15.0' testCompile project(':test-support') jarFileTestCompileOnly "org.projectlombok:lombok:${lombok.version}" From f2f1375612d4161cd1ee29f3c7779b50f3f50d9e Mon Sep 17 00:00:00 2001 From: dark Date: Thu, 30 Jan 2020 02:37:42 +0900 Subject: [PATCH 12/45] Add junit-jupiter dependency in junit 5 quickstart docs (#2301) Co-authored-by: dark --- docs/quickstart/junit_5_quickstart.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/quickstart/junit_5_quickstart.md b/docs/quickstart/junit_5_quickstart.md index 5a07af2473..179a87a544 100644 --- a/docs/quickstart/junit_5_quickstart.md +++ b/docs/quickstart/junit_5_quickstart.md @@ -27,6 +27,7 @@ testCompile "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion" testCompile "org.junit.jupiter:junit-jupiter-params:$junitJupiterVersion" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion" testCompile "org.testcontainers:testcontainers:{{latest_version}}" +testCompile "org.testcontainers:junit-jupiter:{{latest_version}}" ``` ```xml tab='Maven' From 3e214e7bdbedd4a753806853d58e5ad9a8c769b2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 17:38:00 +0000 Subject: [PATCH 13/45] Bump mariadb-java-client from 2.5.3 to 2.5.4 in /modules/mariadb (#2298) Bumps [mariadb-java-client](https://github.com/mariadb-corporation/mariadb-connector-j) from 2.5.3 to 2.5.4. - [Release notes](https://github.com/mariadb-corporation/mariadb-connector-j/releases) - [Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/blob/master/CHANGELOG.md) - [Commits](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.5.3...2.5.4) Signed-off-by: dependabot-preview[bot] --- modules/mariadb/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mariadb/build.gradle b/modules/mariadb/build.gradle index fac747aa68..c7d1dc9667 100644 --- a/modules/mariadb/build.gradle +++ b/modules/mariadb/build.gradle @@ -3,7 +3,7 @@ description = "Testcontainers :: JDBC :: MariaDB" dependencies { compile project(':jdbc') - testCompile 'org.mariadb.jdbc:mariadb-java-client:2.5.3' + testCompile 'org.mariadb.jdbc:mariadb-java-client:2.5.4' testCompile 'com.zaxxer:HikariCP-java6:2.3.13' testCompile 'commons-dbutils:commons-dbutils:1.7' testCompile 'org.apache.tomcat:tomcat-jdbc:9.0.30' From 594738b314341ce4be1cabdf0d9809f441d6b981 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2020 17:38:50 +0000 Subject: [PATCH 14/45] =?UTF-8?q?Bump=20junit-jupiter-api=20from=205.5.2?= =?UTF-8?q?=20to=205.6.0=20in=20/modules/junit-ju=E2=80=A6=20(#2271)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump junit-jupiter-api from 5.5.2 to 5.6.0 in /modules/junit-jupiter Bumps [junit-jupiter-api](https://github.com/junit-team/junit5) from 5.5.2 to 5.6.0. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.5.2...r5.6.0) Signed-off-by: dependabot-preview[bot] * Match engine and API versions to fix compile error Co-authored-by: Richard North --- modules/junit-jupiter/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/junit-jupiter/build.gradle b/modules/junit-jupiter/build.gradle index 7b29e36b4d..7bb6393a58 100644 --- a/modules/junit-jupiter/build.gradle +++ b/modules/junit-jupiter/build.gradle @@ -2,7 +2,7 @@ description = "Testcontainers :: JUnit Jupiter Extension" dependencies { compile project(':testcontainers') - compile 'org.junit.jupiter:junit-jupiter-api:5.5.2' + compile 'org.junit.jupiter:junit-jupiter-api:5.6.0' testCompile project(':mysql') testCompile project(':postgresql') @@ -15,7 +15,7 @@ dependencies { testRuntime 'org.postgresql:postgresql:42.2.9' testRuntime 'mysql:mysql-connector-java:8.0.19' - testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.5.2' + testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.6.0' } test { From a4c5892963d959d18107caf05164bc4155912f6a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2020 08:30:47 +0000 Subject: [PATCH 15/45] Bump java-client from 2.7.11 to 2.7.12 in /modules/couchbase (#2323) Bumps [java-client](https://github.com/couchbase/couchbase-java-client) from 2.7.11 to 2.7.12. - [Release notes](https://github.com/couchbase/couchbase-java-client/releases) - [Commits](https://github.com/couchbase/couchbase-java-client/compare/2.7.11...2.7.12) Signed-off-by: dependabot-preview[bot] --- modules/couchbase/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/couchbase/build.gradle b/modules/couchbase/build.gradle index 27074f1bff..d6a7e51681 100644 --- a/modules/couchbase/build.gradle +++ b/modules/couchbase/build.gradle @@ -2,7 +2,7 @@ description = "Testcontainers :: Couchbase" dependencies { compile project(':testcontainers') - compile 'com.couchbase.client:java-client:2.7.11' + compile 'com.couchbase.client:java-client:2.7.12' testCompile project(':test-support') } From d03aeefbeb8738ddfe10ff36963268dd067790a6 Mon Sep 17 00:00:00 2001 From: worldtiki Date: Wed, 5 Feb 2020 08:38:40 +0000 Subject: [PATCH 16/45] =?UTF-8?q?Add=20small=20delay=20in=20while=20loop?= =?UTF-8?q?=20to=20avoid=20spamming=20logs=20(ResourceR=E2=80=A6=20(#2287)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add small delay in while loop to avoid spamming logs (ResourceReaper) * Add small delay in while loop to avoid spamming logs (ResourceReaper) - Replaced Thread.sleep with RateLimiter --- .../utility/ResourceReaper.java | 62 +++++++++++-------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/core/src/main/java/org/testcontainers/utility/ResourceReaper.java b/core/src/main/java/org/testcontainers/utility/ResourceReaper.java index f46db952c3..f74905e60e 100644 --- a/core/src/main/java/org/testcontainers/utility/ResourceReaper.java +++ b/core/src/main/java/org/testcontainers/utility/ResourceReaper.java @@ -15,10 +15,11 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import org.rnorth.ducttape.ratelimits.RateLimiter; +import org.rnorth.ducttape.ratelimits.RateLimiterBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testcontainers.DockerClientFactory; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -49,6 +50,11 @@ public final class ResourceReaper { private static final Logger LOGGER = LoggerFactory.getLogger(ResourceReaper.class); private static final List>> DEATH_NOTE = new ArrayList<>(); + private static final RateLimiter RYUK_ACK_RATE_LIMITER = RateLimiterBuilder + .newBuilder() + .withRate(4, TimeUnit.SECONDS) + .withConstantThroughput() + .build(); private static ResourceReaper instance; private final DockerClient dockerClient; @@ -110,34 +116,36 @@ public static String start(String hostIpAddress, DockerClient client) { DockerClientFactory.TESTCONTAINERS_THREAD_GROUP, () -> { while (true) { - int index = 0; - try(Socket clientSocket = new Socket(hostIpAddress, ryukPort)) { - FilterRegistry registry = new FilterRegistry(clientSocket.getInputStream(), clientSocket.getOutputStream()); - - synchronized (DEATH_NOTE) { - while (true) { - if (DEATH_NOTE.size() <= index) { - try { - DEATH_NOTE.wait(1_000); - continue; - } catch (InterruptedException e) { - throw new RuntimeException(e); + RYUK_ACK_RATE_LIMITER.doWhenReady(() -> { + int index = 0; + try(Socket clientSocket = new Socket(hostIpAddress, ryukPort)) { + FilterRegistry registry = new FilterRegistry(clientSocket.getInputStream(), clientSocket.getOutputStream()); + + synchronized (DEATH_NOTE) { + while (true) { + if (DEATH_NOTE.size() <= index) { + try { + DEATH_NOTE.wait(1_000); + continue; + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + List> filters = DEATH_NOTE.get(index); + boolean isAcknowledged = registry.register(filters); + if (isAcknowledged) { + log.debug("Received 'ACK' from Ryuk"); + ryukScheduledLatch.countDown(); + index++; + } else { + log.debug("Didn't receive 'ACK' from Ryuk. Will retry to send filters."); } - } - List> filters = DEATH_NOTE.get(index); - boolean isAcknowledged = registry.register(filters); - if (isAcknowledged) { - log.debug("Received 'ACK' from Ryuk"); - ryukScheduledLatch.countDown(); - index++; - } else { - log.debug("Didn't receive 'ACK' from Ryuk. Will retry to send filters."); } } + } catch (IOException e) { + log.warn("Can not connect to Ryuk at {}:{}", hostIpAddress, ryukPort, e); } - } catch (IOException e) { - log.warn("Can not connect to Ryuk at {}:{}", hostIpAddress, ryukPort, e); - } + }); } }, "testcontainers-ryuk" @@ -341,12 +349,12 @@ public void unregisterNetwork(String identifier) { public void unregisterContainer(String identifier) { registeredContainers.remove(identifier); } - + public void registerImageForCleanup(String dockerImageName) { setHook(); registeredImages.add(dockerImageName); } - + private void removeImage(String dockerImageName) { LOGGER.trace("Removing image tagged {}", dockerImageName); try { From 6cd1e356666076ec095fad5518f28f19c1b1f755 Mon Sep 17 00:00:00 2001 From: MariuszCwikla <47976407+MariuszCwikla@users.noreply.github.com> Date: Wed, 5 Feb 2020 09:43:31 +0100 Subject: [PATCH 17/45] Fix localstack cloudwatchlogs service (#2316) --- modules/localstack/build.gradle | 1 + .../localstack/LocalStackContainer.java | 2 +- .../localstack/LocalstackContainerTest.java | 31 +++++++++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/modules/localstack/build.gradle b/modules/localstack/build.gradle index 819419c57e..6d87d282d9 100644 --- a/modules/localstack/build.gradle +++ b/modules/localstack/build.gradle @@ -6,4 +6,5 @@ dependencies { compileOnly 'com.amazonaws:aws-java-sdk-s3:1.11.683' testCompile 'com.amazonaws:aws-java-sdk-s3:1.11.683' testCompile 'com.amazonaws:aws-java-sdk-sqs:1.11.636' + testCompile 'com.amazonaws:aws-java-sdk-logs:1.11.636' } diff --git a/modules/localstack/src/main/java/org/testcontainers/containers/localstack/LocalStackContainer.java b/modules/localstack/src/main/java/org/testcontainers/containers/localstack/LocalStackContainer.java index 36eaacba89..e21cc73544 100644 --- a/modules/localstack/src/main/java/org/testcontainers/containers/localstack/LocalStackContainer.java +++ b/modules/localstack/src/main/java/org/testcontainers/containers/localstack/LocalStackContainer.java @@ -154,7 +154,7 @@ public enum Service { SSM("ssm", 4583), SECRETSMANAGER("secretsmanager", 4584), STEPFUNCTIONS("stepfunctions", 4585), - CLOUDWATCHLOGS("cloudwatchlogs", 4586), + CLOUDWATCHLOGS("logs", 4586), STS("sts", 4592), IAM("iam", 4593); diff --git a/modules/localstack/src/test/java/org/testcontainers/containers/localstack/LocalstackContainerTest.java b/modules/localstack/src/test/java/org/testcontainers/containers/localstack/LocalstackContainerTest.java index 1b222c0fbc..7ad31f6340 100644 --- a/modules/localstack/src/test/java/org/testcontainers/containers/localstack/LocalstackContainerTest.java +++ b/modules/localstack/src/test/java/org/testcontainers/containers/localstack/LocalstackContainerTest.java @@ -1,6 +1,12 @@ package org.testcontainers.containers.localstack; +import com.amazonaws.services.logs.AWSLogs; +import com.amazonaws.services.logs.AWSLogsClientBuilder; +import com.amazonaws.services.logs.model.CreateLogGroupRequest; +import com.amazonaws.services.logs.model.CreateLogGroupResult; +import com.amazonaws.services.logs.model.DescribeLogGroupsRequest; +import com.amazonaws.services.logs.model.LogGroup; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.model.Bucket; @@ -13,6 +19,7 @@ import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.ClassRule; +import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.runners.Enclosed; import org.junit.runner.RunWith; @@ -31,6 +38,7 @@ import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue; import static org.testcontainers.containers.localstack.LocalStackContainer.Service.S3; import static org.testcontainers.containers.localstack.LocalStackContainer.Service.SQS; +import static org.testcontainers.containers.localstack.LocalStackContainer.Service.CLOUDWATCHLOGS; /** * Tests for Localstack Container, used both in bridge network (exposed to host) and docker network modes. @@ -48,7 +56,7 @@ public static class WithoutNetwork { // without_network { @ClassRule public static LocalStackContainer localstack = new LocalStackContainer() - .withServices(S3, SQS); + .withServices(S3, SQS, CLOUDWATCHLOGS); // } @Test @@ -95,6 +103,20 @@ public void sqsTestOverBridgeNetwork() { .count(); assertEquals("the sent message can be received", 1L, messageCount); } + + @Test + @Ignore("Fails due to https://github.com/localstack/localstack/issues/1434") + public void cloudWatchLogsTestOverBridgeNetwork() { + AWSLogs logs = AWSLogsClientBuilder.standard() + .withEndpointConfiguration(localstack.getEndpointConfiguration(CLOUDWATCHLOGS)) + .withCredentials(localstack.getDefaultCredentialsProvider()).build(); + + logs.createLogGroup(new CreateLogGroupRequest("foo")); + + List groups = logs.describeLogGroups().getLogGroups(); + assertEquals("One log group should be created", 1, groups.size()); + assertEquals("Name of created log group is [foo]", "foo", groups.get(0).getLogGroupName()); + } } public static class WithNetwork { @@ -105,7 +127,7 @@ public static class WithNetwork { public static LocalStackContainer localstackInDockerNetwork = new LocalStackContainer() .withNetwork(network) .withNetworkAliases("notthis", "localstack") // the last alias is used for HOSTNAME_EXTERNAL - .withServices(S3, SQS); + .withServices(S3, SQS, CLOUDWATCHLOGS); // } @ClassRule @@ -139,6 +161,11 @@ public void sqsTestOverDockerNetwork() throws Exception { assertTrue("the sent message can be received", message.contains("\"Body\": \"test\"")); } + @Test + public void cloudWatchLogsTestOverDockerNetwork() throws Exception { + runAwsCliAgainstDockerNetworkContainer("logs create-log-group --log-group-name foo", CLOUDWATCHLOGS.getPort()); + } + private String runAwsCliAgainstDockerNetworkContainer(String command, final int port) throws Exception { final String[] commandParts = String.format("/usr/bin/aws --region eu-west-1 %s --endpoint-url http://localstack:%d --no-verify-ssl", command, port).split(" "); final Container.ExecResult execResult = awsCliInDockerNetwork.execInContainer(commandParts); From d360f44de427e19b6d2e86cb040ba4383497a0e9 Mon Sep 17 00:00:00 2001 From: Roberto Franchini Date: Wed, 5 Feb 2020 10:18:02 +0100 Subject: [PATCH 18/45] adds OrientDB 3.0.x module (#1414) Co-authored-by: Richard North Co-authored-by: Sergei Egorov --- docs/modules/databases/orientdb.md | 78 +++++++++ modules/orientdb/build.gradle | 11 ++ .../containers/OrientDBContainer.java | 153 ++++++++++++++++++ .../containers/OrientDBContainerTest.java | 73 +++++++++ .../src/test/resources/initscript.osql | 6 + .../src/test/resources/logback-test.xml | 18 +++ 6 files changed, 339 insertions(+) create mode 100644 docs/modules/databases/orientdb.md create mode 100644 modules/orientdb/build.gradle create mode 100644 modules/orientdb/src/main/java/org/testcontainers/containers/OrientDBContainer.java create mode 100644 modules/orientdb/src/test/java/org/testcontainers/containers/OrientDBContainerTest.java create mode 100644 modules/orientdb/src/test/resources/initscript.osql create mode 100644 modules/orientdb/src/test/resources/logback-test.xml diff --git a/docs/modules/databases/orientdb.md b/docs/modules/databases/orientdb.md new file mode 100644 index 0000000000..80ed96f954 --- /dev/null +++ b/docs/modules/databases/orientdb.md @@ -0,0 +1,78 @@ +# OrientDB Module + +!!! note + This module is INCUBATING. While it is ready for use and operational in the current version of Testcontainers, it is possible that it may receive breaking changes in the future. See [our contributing guidelines](/contributing/#incubating-modules) for more information on our incubating modules policy. + + +This module helps running [OrientDB](https://orientdb.org/download) using Testcontainers. + +Note that it's based on the [official Docker image](https://hub.docker.com/_/orientdb/) provided by OrientDB. + +## Usage example + +Declare your Testcontainer as a `@ClassRule` or `@Rule` in a JUnit 4 test or as static or member attribute of a JUnit 5 test annotated with `@Container` as you would with other Testcontainers. +You can call `getDbUrl()` OrientDB container and build the `ODatabaseSession` by your own, but a more useful `getSession()` method is provided. +On the JVM you would most likely use the [Java driver](https://github.com/). + +The following example uses the JUnit 5 extension `@Testcontainers` and demonstrates both the usage of the Java Client: + +```java tab="JUnit 5 example" +@Testcontainers +public class ExampleTest { + + @Container + private static OrientDBContainer container = new OrientDBContainer(); + + @Test + void testDbCreation() { + + final ODatabaseSession session = container.getSession(); + + session.command("CREATE CLASS Person EXTENDS V"); + session.command("INSERT INTO Person set name='john'"); + session.command("INSERT INTO Person set name='jane'"); + + assertThat(session.query("SELECT FROM Person").stream()).hasSize(2); + } + +} +``` + +You are not limited to Unit tests and can of course use an instance of the OrientDB Testcontainer in vanilla Java code as well. + + +## Adding this module to your project dependencies + +Add the following dependency to your `pom.xml`/`build.gradle` file: + +```groovy tab='Gradle' +testCompile "org.testcontainers:orientdb:{{latest_version}}" +``` + +```xml tab='Maven' + + org.testcontainers + orientdb + {{latest_version}} + test + +``` + +!!! hint + Add the OrientDB Java client if you plan to access the Testcontainer: + + ```groovy tab='Gradle' + compile "com.orientechnologies:orientdb-client:3.0.24" + ``` + + ```xml tab='Maven' + + com.orientechnologies + orientdb-client + 3.0.24 + + ``` + + + + diff --git a/modules/orientdb/build.gradle b/modules/orientdb/build.gradle new file mode 100644 index 0000000000..ffa1350172 --- /dev/null +++ b/modules/orientdb/build.gradle @@ -0,0 +1,11 @@ +description = "TestContainers :: Orientdb" + +dependencies { + compile project(":testcontainers") + + compile "com.orientechnologies:orientdb-client:3.0.24" + + testCompile 'org.assertj:assertj-core:3.12.0' + testCompile 'org.apache.tinkerpop:gremlin-driver:3.3.4' + testCompile "com.orientechnologies:orientdb-gremlin:3.0.18" +} diff --git a/modules/orientdb/src/main/java/org/testcontainers/containers/OrientDBContainer.java b/modules/orientdb/src/main/java/org/testcontainers/containers/OrientDBContainer.java new file mode 100644 index 0000000000..b368d96bf8 --- /dev/null +++ b/modules/orientdb/src/main/java/org/testcontainers/containers/OrientDBContainer.java @@ -0,0 +1,153 @@ +package org.testcontainers.containers; + +import com.github.dockerjava.api.command.InspectContainerResponse; +import com.orientechnologies.orient.core.db.ODatabaseSession; +import com.orientechnologies.orient.core.db.ODatabaseType; +import com.orientechnologies.orient.core.db.OrientDB; +import com.orientechnologies.orient.core.db.OrientDBConfig; +import lombok.NonNull; +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; +import org.testcontainers.containers.wait.strategy.Wait; +import org.testcontainers.containers.wait.strategy.WaitAllStrategy; +import org.testcontainers.containers.wait.strategy.WaitStrategy; + +import java.io.IOException; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Optional; + +import static java.net.HttpURLConnection.HTTP_OK; + +/** + * @author robfrank + */ +public class OrientDBContainer extends GenericContainer { + private static final Logger LOGGER = LoggerFactory.getLogger(OrientDBContainer.class); + + private static final String DEFAULT_IMAGE_NAME = "orientdb"; + private static final String DEFAULT_TAG = "3.0.24-tp3"; + private static final String DOCKER_IMAGE_NAME = DEFAULT_IMAGE_NAME + ":" + DEFAULT_TAG; + + private static final String DEFAULT_USERNAME = "admin"; + private static final String DEFAULT_PASSWORD = "admin"; + private static final String DEFAULT_SERVER_PASSWORD = "root"; + + private static final String DEFAULT_DATABASE_NAME = "testcontainers"; + + private static final int DEFAULT_BINARY_PORT = 2424; + private static final int DEFAULT_HTTP_PORT = 2480; + + private String databaseName; + private String serverPassword; + private Optional scriptPath = Optional.empty(); + + private OrientDB orientDB; + private ODatabaseSession session; + + public OrientDBContainer() { + this(DOCKER_IMAGE_NAME); + } + + public OrientDBContainer(@NonNull String dockerImageName) { + super(dockerImageName); + + serverPassword = DEFAULT_SERVER_PASSWORD; + databaseName = DEFAULT_DATABASE_NAME; + + WaitStrategy waitForHttp = new HttpWaitStrategy() + .forPort(DEFAULT_HTTP_PORT) + .forStatusCodeMatching(response -> response == HTTP_OK); + + waitStrategy = new WaitAllStrategy() + .withStrategy(Wait.forListeningPort()) + .withStrategy(waitForHttp) + .withStartupTimeout(Duration.ofMinutes(2)); + } + + @Override + protected void configure() { + addExposedPorts(DEFAULT_BINARY_PORT, DEFAULT_HTTP_PORT); + addEnv("ORIENTDB_ROOT_PASSWORD", serverPassword); + } + + public String getDatabaseName() { + return databaseName; + } + + public String getTestQueryString() { + return "SELECT FROM V"; + } + + public OrientDBContainer withDatabaseName(final String databaseName) { + this.databaseName = databaseName; + return self(); + } + + public OrientDBContainer withServerPassword(final String serverPassword) { + this.serverPassword = serverPassword; + return self(); + } + + public OrientDBContainer withScriptPath(String scriptPath) { + this.scriptPath = Optional.of(scriptPath); + return self(); + } + + @Override + protected void containerIsStarted(InspectContainerResponse containerInfo) { + orientDB = new OrientDB(getServerUrl(), "root", serverPassword, OrientDBConfig.defaultConfig()); + } + + public OrientDB getOrientDB() { + return orientDB; + } + + public String getServerUrl() { + return "remote:" + getContainerIpAddress() + ":" + getMappedPort(2424); + } + + public String getDbUrl() { + return getServerUrl() + "/" + databaseName; + } + + public ODatabaseSession getSession() { + return getSession(DEFAULT_USERNAME, DEFAULT_PASSWORD); + } + + public synchronized ODatabaseSession getSession(String username, String password) { + orientDB.createIfNotExists(databaseName, ODatabaseType.PLOCAL); + + if (session == null) { + session = orientDB.open(databaseName, username, password); + + scriptPath.ifPresent(path -> loadScript(path, session)); + } + return session; + } + + private void loadScript(String path, ODatabaseSession session) { + try { + URL resource = getClass().getClassLoader().getResource(path); + + if (resource == null) { + LOGGER.warn("Could not load classpath init script: {}", scriptPath); + throw new RuntimeException("Could not load classpath init script: " + scriptPath + ". Resource not found."); + } + + String script = IOUtils.toString(resource, StandardCharsets.UTF_8); + + session.execute("sql", script); + } catch (IOException e) { + LOGGER.warn("Could not load classpath init script: {}", scriptPath); + throw new RuntimeException("Could not load classpath init script: " + scriptPath, e); + } catch (UnsupportedOperationException e) { + LOGGER.error("Error while executing init script: {}", scriptPath, e); + throw new RuntimeException("Error while executing init script: " + scriptPath, e); + } + } + +} diff --git a/modules/orientdb/src/test/java/org/testcontainers/containers/OrientDBContainerTest.java b/modules/orientdb/src/test/java/org/testcontainers/containers/OrientDBContainerTest.java new file mode 100644 index 0000000000..0a067b375b --- /dev/null +++ b/modules/orientdb/src/test/java/org/testcontainers/containers/OrientDBContainerTest.java @@ -0,0 +1,73 @@ +package org.testcontainers.containers; + +import com.orientechnologies.orient.core.db.ODatabaseSession; +import org.junit.Test; + +import static org.assertj.core.api.Assertions.*; + +/** + * @author robfrank + */ +public class OrientDBContainerTest { + + @Test + public void shouldReturnTheSameSession() { + try (OrientDBContainer container = new OrientDBContainer()) { + container.start(); + + final ODatabaseSession session = container.getSession(); + final ODatabaseSession session2 = container.getSession(); + + assertThat(session).isSameAs(session2); + } + } + + @Test + public void shouldInitializeWithCommands() { + try (OrientDBContainer container = new OrientDBContainer()) { + container.start(); + + final ODatabaseSession session = container.getSession(); + + session.command("CREATE CLASS Person EXTENDS V"); + session.command("INSERT INTO Person set name='john'"); + session.command("INSERT INTO Person set name='jane'"); + + assertThat(session.query("SELECT FROM Person").stream()).hasSize(2); + } + } + + @Test + public void shouldQueryWithGremlin() { + + try (OrientDBContainer container = new OrientDBContainer()) { + container.start(); + + final ODatabaseSession session = container.getSession("admin", "admin"); + + session.command("CREATE CLASS Person EXTENDS V"); + session.command("INSERT INTO Person set name='john'"); + session.command("INSERT INTO Person set name='jane'"); + + assertThat(session.execute("gremlin", + "g.V().hasLabel('Person')").stream()).hasSize(2); + } + } + + @Test + public void shouldInitializeDatabaseFromScript() { + try (OrientDBContainer container = new OrientDBContainer() + .withScriptPath("initscript.osql") + .withDatabaseName("persons")) { + + container.start(); + + assertThat(container.getDbUrl()) + .isEqualTo("remote:" + container.getContainerIpAddress() + ":" + container.getMappedPort(2424) + "/persons"); + + final ODatabaseSession session = container.getSession(); + + assertThat(session.query("SELECT FROM Person").stream()).hasSize(4); + } + } +} diff --git a/modules/orientdb/src/test/resources/initscript.osql b/modules/orientdb/src/test/resources/initscript.osql new file mode 100644 index 0000000000..e1ba22bbb3 --- /dev/null +++ b/modules/orientdb/src/test/resources/initscript.osql @@ -0,0 +1,6 @@ +CREATE CLASS Person EXTENDS V; + +INSERT INTO Person set name="john"; +INSERT INTO Person set name="paul"; +INSERT INTO Person set name="luke"; +INSERT INTO Person set name="albert"; diff --git a/modules/orientdb/src/test/resources/logback-test.xml b/modules/orientdb/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..7bd6a94d82 --- /dev/null +++ b/modules/orientdb/src/test/resources/logback-test.xml @@ -0,0 +1,18 @@ + + + + + + %d{HH:mm:ss.SSS} %-5level %logger - %msg%n + + + + + + + + + + + \ No newline at end of file From 9f74b8874e65e4b08030bad7dfb1c4a75d8e14e0 Mon Sep 17 00:00:00 2001 From: Richard North Date: Fri, 7 Feb 2020 20:56:15 +0000 Subject: [PATCH 19/45] Pin mkdocs dependencies to avoid version incompatibility (#2335) See https://github.com/squidfunk/mkdocs-material/issues/1450 for more background --- requirements.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index a936d8a0a9..dd80510a4b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -mkdocs +mkdocs==1.0.4 -e git+https://github.com/rnorth/mkdocs-codeinclude-plugin#egg=mkdocs_codeinclude_plugin -mkdocs-material -mkdocs-markdownextradata-plugin +mkdocs-material==4.6.0 +mkdocs-markdownextradata-plugin==0.1.1 +markdown>=3.1,<3.2 From 62249f7bbd8eecc8c35122794f810c3dbcf1bc95 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Sat, 8 Feb 2020 21:07:45 +0100 Subject: [PATCH 20/45] Add Presto container (#2196) * Add Presto container * Add incubating note to module docs Co-authored-by: Richard North --- docs/modules/databases/index.md | 4 + docs/modules/databases/presto.md | 88 +++++++++++++ mkdocs.yml | 1 + modules/jdbc-test/build.gradle | 2 + .../testcontainers/jdbc/JDBCDriverTest.java | 1 + modules/presto/build.gradle | 8 ++ .../containers/PrestoContainer.java | 104 +++++++++++++++ .../containers/PrestoContainerProvider.java | 35 +++++ ...s.containers.JdbcDatabaseContainerProvider | 1 + .../containers/PrestoContainerTest.java | 121 ++++++++++++++++++ modules/presto/src/test/resources/initial.sql | 2 + 11 files changed, 367 insertions(+) create mode 100644 docs/modules/databases/presto.md create mode 100644 modules/presto/build.gradle create mode 100644 modules/presto/src/main/java/org/testcontainers/containers/PrestoContainer.java create mode 100644 modules/presto/src/main/java/org/testcontainers/containers/PrestoContainerProvider.java create mode 100644 modules/presto/src/main/resources/META-INF/services/org.testcontainers.containers.JdbcDatabaseContainerProvider create mode 100644 modules/presto/src/test/java/org/testcontainers/containers/PrestoContainerTest.java create mode 100644 modules/presto/src/test/resources/initial.sql diff --git a/docs/modules/databases/index.md b/docs/modules/databases/index.md index 3202695380..d7654cc6a3 100644 --- a/docs/modules/databases/index.md +++ b/docs/modules/databases/index.md @@ -69,6 +69,10 @@ Insert `tc:` after `jdbc:` as follows. Note that the hostname, port and database `jdbc:tc:postgis:9.6:///databasename` +### Using Presto + +`jdbc:tc:presto:329://localhost/memory/default` + ## Using a classpath init script Testcontainers can run an init script after the database container is started, but before your code is given a connection to it. The script must be on the classpath, and is referenced as follows: diff --git a/docs/modules/databases/presto.md b/docs/modules/databases/presto.md new file mode 100644 index 0000000000..52776d06da --- /dev/null +++ b/docs/modules/databases/presto.md @@ -0,0 +1,88 @@ +# Presto Module + +!!! note + This module is INCUBATING. While it is ready for use and operational in the current version of Testcontainers, it is possible that it may receive breaking changes in the future. See [our contributing guidelines](/contributing/#incubating-modules) for more information on our incubating modules policy. + +See [Database containers](./index.md) for documentation and usage that is common to all database container types. + +## Usage example + +Running Presto as a stand-in for in a test: + +```java +public class SomeTest { + + @Rule + public PrestoContainer presto = new PrestoContainer(); + + @Test + public void someTestMethod() { + String url = presto.getJdbcUrl(); + + ... create a connection and run test as normal +``` + +Presto comes with several catalogs preconfigured. Most useful ones for testing are + +* `tpch` catalog using the [Presto TPCH Connector](https://prestosql.io/docs/current/connector/tpch.html). + This is a read-only catalog that defines standard TPCH schema, so is available for querying without a need + to create any tables. +* `memory` catalog using the [Presto Memory Connector](https://prestosql.io/docs/current/connector/memory.html). + This catalog can be used for creating schemas and tables and does not require any storage, as everything + is stored fully in-memory. + +Example test using the `tpch` and `memory` catalogs: + +```java +public class SomeTest { + @Rule + public PrestoContainer prestoSql = new PrestoContainer(); + + @Test + public void queryMemoryAndTpchConnectors() throws SQLException { + try (Connection connection = prestoSql.createConnection(); + Statement statement = connection.createStatement()) { + // Prepare data + statement.execute("CREATE TABLE memory.default.table_with_array AS SELECT 1 id, ARRAY[1, 42, 2, 42, 4, 42] my_array"); + + // Query Presto using newly created table and a builtin connector + try (ResultSet resultSet = statement.executeQuery("" + + "SELECT nationkey, element " + + "FROM tpch.tiny.nation " + + "JOIN memory.default.table_with_array twa ON nationkey = twa.id " + + "LEFT JOIN UNNEST(my_array) a(element) ON true " + + "ORDER BY element OFFSET 1 FETCH NEXT 3 ROWS WITH TIES ")) { + List actualElements = new ArrayList<>(); + while (resultSet.next()) { + actualElements.add(resultSet.getInt("element")); + } + Assert.assertEquals(Arrays.asList(2, 4, 42, 42, 42), actualElements); + } + } + } +} +``` + +## Adding this module to your project dependencies + +Add the following dependency to your `pom.xml`/`build.gradle` file: + +```groovy tab='Gradle' +testCompile "org.testcontainers:presto:{{latest_version}}" +``` + +```xml tab='Maven' + + org.testcontainers + presto + {{latest_version}} + test + +``` + +!!! hint + Adding this Testcontainers library JAR will not automatically add the Presto JDBC driver JAR to your project. + You should ensure that your project has the Presto JDBC driver as a dependency, if you plan on using it. + Refer to [Presto project download page](https://prestosql.io/download.html) for instructions. + + diff --git a/mkdocs.yml b/mkdocs.yml index 189bc3b678..f66f382ccb 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -53,6 +53,7 @@ nav: - modules/databases/neo4j.md - modules/databases/oraclexe.md - modules/databases/postgres.md + - modules/databases/presto.md - modules/docker_compose.md - modules/elasticsearch.md - modules/kafka.md diff --git a/modules/jdbc-test/build.gradle b/modules/jdbc-test/build.gradle index 842f2a761e..c7c909782b 100644 --- a/modules/jdbc-test/build.gradle +++ b/modules/jdbc-test/build.gradle @@ -7,6 +7,7 @@ repositories { dependencies { compile project(':mysql') compile project(':postgresql') + compile project(':presto') compile project(':cockroachdb') compile project(':mariadb') compile project(':oracle-xe') @@ -16,6 +17,7 @@ dependencies { testCompile 'com.google.guava:guava:18.0' testCompile 'org.postgresql:postgresql:42.0.0' + testCompile 'io.prestosql:presto-jdbc:329' testCompile 'mysql:mysql-connector-java:8.0.14' testCompile 'org.mariadb.jdbc:mariadb-java-client:1.4.6' testCompile 'com.oracle:ojdbc6:12.1.0.1-atlassian-hosted' diff --git a/modules/jdbc-test/src/test/java/org/testcontainers/jdbc/JDBCDriverTest.java b/modules/jdbc-test/src/test/java/org/testcontainers/jdbc/JDBCDriverTest.java index 2089513df0..ca55a1d184 100644 --- a/modules/jdbc-test/src/test/java/org/testcontainers/jdbc/JDBCDriverTest.java +++ b/modules/jdbc-test/src/test/java/org/testcontainers/jdbc/JDBCDriverTest.java @@ -53,6 +53,7 @@ public static Iterable data() { {"jdbc:tc:postgresql:9.6.8://hostname/databasename?user=someuser&password=somepwd", EnumSet.of(Options.JDBCParams)}, {"jdbc:tc:postgis://hostname/databasename?user=someuser&password=somepwd", EnumSet.of(Options.JDBCParams)}, {"jdbc:tc:postgis:9.6://hostname/databasename?user=someuser&password=somepwd", EnumSet.of(Options.JDBCParams)}, + {"jdbc:tc:presto:329://hostname/", EnumSet.of(Options.PmdKnownBroken)}, {"jdbc:tc:mysql:5.6://hostname/databasename?TC_MY_CNF=somepath/mysql_conf_override", EnumSet.of(Options.CustomIniFile)}, {"jdbc:tc:mariadb://hostname/databasename", EnumSet.noneOf(Options.class)}, {"jdbc:tc:mariadb://hostname/databasename?user=someuser&TC_INITSCRIPT=somepath/init_mariadb.sql", EnumSet.of(Options.ScriptedSchema, Options.JDBCParams)}, diff --git a/modules/presto/build.gradle b/modules/presto/build.gradle new file mode 100644 index 0000000000..07aad11168 --- /dev/null +++ b/modules/presto/build.gradle @@ -0,0 +1,8 @@ +description = "Testcontainers :: JDBC :: Presto" + +dependencies { + compile project(':jdbc') + + testCompile 'io.prestosql:presto-jdbc:329' + testCompile 'commons-dbutils:commons-dbutils:1.7' +} diff --git a/modules/presto/src/main/java/org/testcontainers/containers/PrestoContainer.java b/modules/presto/src/main/java/org/testcontainers/containers/PrestoContainer.java new file mode 100644 index 0000000000..186acb18af --- /dev/null +++ b/modules/presto/src/main/java/org/testcontainers/containers/PrestoContainer.java @@ -0,0 +1,104 @@ +package org.testcontainers.containers; + +import org.jetbrains.annotations.NotNull; +import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; + +import java.sql.Connection; +import java.sql.SQLException; +import java.time.Duration; +import java.util.HashSet; +import java.util.Set; + +import static com.google.common.base.Strings.nullToEmpty; +import static java.lang.String.format; +import static java.time.temporal.ChronoUnit.SECONDS; + +public class PrestoContainer> extends JdbcDatabaseContainer { + public static final String NAME = "presto"; + public static final String IMAGE = "prestosql/presto"; + public static final String DEFAULT_TAG = "329"; + + public static final Integer PRESTO_PORT = 8080; + + private String username = "test"; + private String catalog = null; + + public PrestoContainer() { + this(IMAGE + ":" + DEFAULT_TAG); + } + + public PrestoContainer(final String dockerImageName) { + super(dockerImageName); + this.waitStrategy = new LogMessageWaitStrategy() + .withRegEx(".*io.prestosql.server.PrestoServer\\s+======== SERVER STARTED ========.*") + .withStartupTimeout(Duration.of(60, SECONDS)); + } + + @NotNull + @Override + protected Set getLivenessCheckPorts() { + return new HashSet<>(getMappedPort(PRESTO_PORT)); + } + + @Override + protected void configure() { + addExposedPort(PRESTO_PORT); + } + + @Override + public String getDriverClassName() { + return "io.prestosql.jdbc.PrestoDriver"; + } + + @Override + public String getJdbcUrl() { + return format("jdbc:presto://%s:%s/%s", getContainerIpAddress(), getMappedPort(PRESTO_PORT), nullToEmpty(catalog)); + } + + @Override + public String getUsername() { + return username; + } + + @Override + public String getPassword() { + return ""; + } + + @Override + public String getDatabaseName() { + return catalog; + } + + @Override + public String getTestQueryString() { + return "SELECT count(*) FROM tpch.tiny.nation"; + } + + @Override + public SELF withUsername(final String username) { + this.username = username; + return self(); + } + + /** + * @deprecated This operation is not supported. + */ + @Override + @Deprecated + public SELF withPassword(final String password) { + // ignored, Presto does not support password authentication without TLS + // TODO: make JDBCDriverTest not pass a password unconditionally and remove this method + return self(); + } + + @Override + public SELF withDatabaseName(String dbName) { + this.catalog = dbName; + return self(); + } + + public Connection createConnection() throws SQLException, NoDriverFoundException { + return createConnection(""); + } +} diff --git a/modules/presto/src/main/java/org/testcontainers/containers/PrestoContainerProvider.java b/modules/presto/src/main/java/org/testcontainers/containers/PrestoContainerProvider.java new file mode 100644 index 0000000000..663cf9be4a --- /dev/null +++ b/modules/presto/src/main/java/org/testcontainers/containers/PrestoContainerProvider.java @@ -0,0 +1,35 @@ +package org.testcontainers.containers; + +import org.testcontainers.jdbc.ConnectionUrl; + +import java.util.Objects; + +/** + * Factory for Presto containers. + */ +public class PrestoContainerProvider extends JdbcDatabaseContainerProvider { + + public static final String USER_PARAM = "user"; + public static final String PASSWORD_PARAM = "password"; + + @Override + public boolean supports(String databaseType) { + return databaseType.equals(PrestoContainer.NAME); + } + + @Override + public JdbcDatabaseContainer newInstance() { + return newInstance(PrestoContainer.DEFAULT_TAG); + } + + @Override + public JdbcDatabaseContainer newInstance(String tag) { + return new PrestoContainer(PrestoContainer.IMAGE + ":" + tag); + } + + @Override + public JdbcDatabaseContainer newInstance(ConnectionUrl connectionUrl) { + return newInstanceFromConnectionUrl(connectionUrl, USER_PARAM, PASSWORD_PARAM); + } + +} diff --git a/modules/presto/src/main/resources/META-INF/services/org.testcontainers.containers.JdbcDatabaseContainerProvider b/modules/presto/src/main/resources/META-INF/services/org.testcontainers.containers.JdbcDatabaseContainerProvider new file mode 100644 index 0000000000..ad36a36a11 --- /dev/null +++ b/modules/presto/src/main/resources/META-INF/services/org.testcontainers.containers.JdbcDatabaseContainerProvider @@ -0,0 +1 @@ +org.testcontainers.containers.PrestoContainerProvider diff --git a/modules/presto/src/test/java/org/testcontainers/containers/PrestoContainerTest.java b/modules/presto/src/test/java/org/testcontainers/containers/PrestoContainerTest.java new file mode 100644 index 0000000000..07fb6fa30e --- /dev/null +++ b/modules/presto/src/test/java/org/testcontainers/containers/PrestoContainerTest.java @@ -0,0 +1,121 @@ +package org.testcontainers.containers; + +import org.junit.Assert; +import org.junit.Test; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static java.lang.Integer.parseInt; +import static java.lang.String.format; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * @author findepi + */ +public class PrestoContainerTest { + @Test + public void testSimple() throws Exception { + try (PrestoContainer prestoSql = new PrestoContainer<>()) { + prestoSql.start(); + try (Connection connection = prestoSql.createConnection(); + Statement statement = connection.createStatement(); + ResultSet resultSet = statement.executeQuery("SELECT DISTINCT node_version FROM system.runtime.nodes")) { + assertTrue("No result", resultSet.next()); + assertEquals("Presto version", PrestoContainer.DEFAULT_TAG, resultSet.getString("node_version")); + } + } + } + + @Test + public void testSpecificVersion() throws Exception { + String prestoVersion = Integer.toString(parseInt(PrestoContainer.DEFAULT_TAG) - 1); + try (PrestoContainer prestoSql = new PrestoContainer<>("prestosql/presto:" + prestoVersion)) { + prestoSql.start(); + try (Connection connection = prestoSql.createConnection(); + Statement statement = connection.createStatement(); + ResultSet resultSet = statement.executeQuery("SELECT DISTINCT node_version FROM system.runtime.nodes")) { + assertTrue("No result", resultSet.next()); + assertEquals("Presto version", prestoVersion, resultSet.getString("node_version")); + } + } + } + + @Test + public void testQueryMemoryAndTpch() throws SQLException { + try (PrestoContainer prestoSql = new PrestoContainer<>()) { + prestoSql.start(); + try (Connection connection = prestoSql.createConnection(); + Statement statement = connection.createStatement()) { + // Prepare data + statement.execute("CREATE TABLE memory.default.table_with_array AS SELECT 1 id, ARRAY[1, 42, 2, 42, 4, 42] my_array"); + + // Query Presto using newly created table and a builtin connector + try (ResultSet resultSet = statement.executeQuery("" + + "SELECT nationkey, element " + + "FROM tpch.tiny.nation " + + "JOIN memory.default.table_with_array twa ON nationkey = twa.id " + + "LEFT JOIN UNNEST(my_array) a(element) ON true " + + "ORDER BY element OFFSET 1 FETCH NEXT 3 ROWS WITH TIES ")) { + List actualElements = new ArrayList<>(); + while (resultSet.next()) { + actualElements.add(resultSet.getInt("element")); + } + Assert.assertEquals(Arrays.asList(2, 4, 42, 42, 42), actualElements); + } + } + } + } + + @Test + public void testInitScript() throws Exception { + try (PrestoContainer prestoSql = new PrestoContainer<>()) { + prestoSql.withInitScript("initial.sql"); + prestoSql.start(); + try (Connection connection = prestoSql.createConnection(); + Statement statement = connection.createStatement(); + ResultSet resultSet = statement.executeQuery("SELECT a FROM memory.default.test_table")) { + assertTrue("No result", resultSet.next()); + assertEquals("Value", 12345678909324L, resultSet.getObject("a")); + assertFalse("Too many result", resultSet.next()); + } + } + } + + @Test + public void testTcJdbcUri() throws Exception { + try (Connection connection = DriverManager.getConnection(format("jdbc:tc:presto:%s://hostname/", PrestoContainer.DEFAULT_TAG))) { + // Verify metadata with tc: JDBC connection URI + assertEquals(connection.getMetaData().getDatabaseMajorVersion(), parseInt(PrestoContainer.DEFAULT_TAG)); + + // Verify transactions with tc: JDBC connection URI + assertTrue("Is autocommit", connection.getAutoCommit()); + connection.setAutoCommit(false); + assertFalse("Is autocommit", connection.getAutoCommit()); + assertEquals("Transaction isolation", Connection.TRANSACTION_READ_UNCOMMITTED, connection.getTransactionIsolation()); + + try (Statement statement = connection.createStatement()) { + assertEquals("Update result", 0, statement.executeUpdate("CREATE TABLE memory.default.test_tc(a bigint)")); + try (ResultSet resultSet = statement.executeQuery("SELECT sum(cast(node_version AS bigint)) AS v FROM system.runtime.nodes")) { + assertTrue(resultSet.next()); + assertEquals(PrestoContainer.DEFAULT_TAG, resultSet.getString("v")); + assertFalse(resultSet.next()); + } + connection.commit(); + } finally { + connection.rollback(); + } + connection.setAutoCommit(true); + assertTrue("Is autocommit", connection.getAutoCommit()); + assertEquals("Transaction isolation should be retained", Connection.TRANSACTION_READ_UNCOMMITTED, connection.getTransactionIsolation()); + } + } +} diff --git a/modules/presto/src/test/resources/initial.sql b/modules/presto/src/test/resources/initial.sql new file mode 100644 index 0000000000..1a3ecdab4f --- /dev/null +++ b/modules/presto/src/test/resources/initial.sql @@ -0,0 +1,2 @@ +CREATE TABLE memory.default.test_table(a bigint); +INSERT INTO memory.default.test_table(a) VALUES (12345678909324); From 803eb6880d123f2d77bc82b4e9fa1b7fe0f8ba1d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 8 Feb 2020 20:08:35 +0000 Subject: [PATCH 21/45] =?UTF-8?q?Bump=20aws-java-sdk-logs=20from=201.11.63?= =?UTF-8?q?6=20to=201.11.717=20in=20/modules/lo=E2=80=A6=20(#2327)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [aws-java-sdk-logs](https://github.com/aws/aws-sdk-java) from 1.11.636 to 1.11.717. - [Release notes](https://github.com/aws/aws-sdk-java/releases) - [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java/compare/1.11.636...1.11.717) Signed-off-by: dependabot-preview[bot] --- modules/localstack/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/localstack/build.gradle b/modules/localstack/build.gradle index 6d87d282d9..81490d2dae 100644 --- a/modules/localstack/build.gradle +++ b/modules/localstack/build.gradle @@ -6,5 +6,5 @@ dependencies { compileOnly 'com.amazonaws:aws-java-sdk-s3:1.11.683' testCompile 'com.amazonaws:aws-java-sdk-s3:1.11.683' testCompile 'com.amazonaws:aws-java-sdk-sqs:1.11.636' - testCompile 'com.amazonaws:aws-java-sdk-logs:1.11.636' + testCompile 'com.amazonaws:aws-java-sdk-logs:1.11.717' } From a70e1c636bdd809b7704deb0cb41428c70fedfee Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 8 Feb 2020 20:08:53 +0000 Subject: [PATCH 22/45] Bump lombok from 1.18.10 to 1.18.12 in /examples (#2333) Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.10 to 1.18.12. - [Release notes](https://github.com/rzwitserloot/lombok/releases) - [Changelog](https://github.com/rzwitserloot/lombok/blob/master/doc/changelog.markdown) - [Commits](https://github.com/rzwitserloot/lombok/compare/v1.18.10...v1.18.12) Signed-off-by: dependabot-preview[bot] --- examples/disque-job-queue/build.gradle | 2 +- examples/spring-boot/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/disque-job-queue/build.gradle b/examples/disque-job-queue/build.gradle index 1f4e257cad..fb8413bdec 100644 --- a/examples/disque-job-queue/build.gradle +++ b/examples/disque-job-queue/build.gradle @@ -7,7 +7,7 @@ repositories { } dependencies { - compileOnly "org.projectlombok:lombok:1.18.10" + compileOnly "org.projectlombok:lombok:1.18.12" annotationProcessor "org.projectlombok:lombok:1.18.10" implementation 'biz.paluch.redis:spinach:0.3' implementation 'com.google.code.gson:gson:2.8.6' diff --git a/examples/spring-boot/build.gradle b/examples/spring-boot/build.gradle index e74e04a95e..49052847de 100644 --- a/examples/spring-boot/build.gradle +++ b/examples/spring-boot/build.gradle @@ -9,7 +9,7 @@ repositories { } dependencies { - compileOnly "org.projectlombok:lombok:1.18.10" + compileOnly "org.projectlombok:lombok:1.18.12" annotationProcessor "org.projectlombok:lombok:1.18.10" implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-data-redis' From 9c3ab5410d86ef7fd8d114809cba746f44a21fc4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 8 Feb 2020 20:09:08 +0000 Subject: [PATCH 23/45] Bump postgresql from 42.2.9 to 42.2.10 in /modules/spock (#2329) Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.2.9 to 42.2.10. - [Release notes](https://github.com/pgjdbc/pgjdbc/releases) - [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md) - [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.2.9...REL42.2.10) Signed-off-by: dependabot-preview[bot] --- modules/spock/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/spock/build.gradle b/modules/spock/build.gradle index f26858947c..c7b51cc9c5 100644 --- a/modules/spock/build.gradle +++ b/modules/spock/build.gradle @@ -13,6 +13,6 @@ dependencies { testCompile 'com.zaxxer:HikariCP:3.4.2' testCompile 'org.apache.httpcomponents:httpclient:4.5.11' - testRuntime 'org.postgresql:postgresql:42.2.9' + testRuntime 'org.postgresql:postgresql:42.2.10' testRuntime 'mysql:mysql-connector-java:8.0.19' } From 5543c1b7062440837f9f209bea8bf9b35f289abc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 8 Feb 2020 20:09:19 +0000 Subject: [PATCH 24/45] Bump postgresql from 42.2.9 to 42.2.10 in /modules/postgresql (#2328) Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.2.9 to 42.2.10. - [Release notes](https://github.com/pgjdbc/pgjdbc/releases) - [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md) - [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.2.9...REL42.2.10) Signed-off-by: dependabot-preview[bot] --- modules/postgresql/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/postgresql/build.gradle b/modules/postgresql/build.gradle index a4bf697a3a..9acf9ead2a 100644 --- a/modules/postgresql/build.gradle +++ b/modules/postgresql/build.gradle @@ -3,7 +3,7 @@ description = "Testcontainers :: JDBC :: PostgreSQL" dependencies { compile project(':jdbc') - testCompile 'org.postgresql:postgresql:42.2.9' + testCompile 'org.postgresql:postgresql:42.2.10' testCompile 'commons-dbutils:commons-dbutils:1.7' testCompile 'com.zaxxer:HikariCP-java6:2.3.13' } From 6ec4d1e791d49ea1ca43ddbdfe047291e98eddc5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 8 Feb 2020 20:09:30 +0000 Subject: [PATCH 25/45] Bump postgresql from 42.2.9 to 42.2.10 in /modules/junit-jupiter (#2330) Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.2.9 to 42.2.10. - [Release notes](https://github.com/pgjdbc/pgjdbc/releases) - [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md) - [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.2.9...REL42.2.10) Signed-off-by: dependabot-preview[bot] --- modules/junit-jupiter/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/junit-jupiter/build.gradle b/modules/junit-jupiter/build.gradle index 7bb6393a58..b01333b5ec 100644 --- a/modules/junit-jupiter/build.gradle +++ b/modules/junit-jupiter/build.gradle @@ -13,7 +13,7 @@ dependencies { exclude(module: 'hamcrest-core') } - testRuntime 'org.postgresql:postgresql:42.2.9' + testRuntime 'org.postgresql:postgresql:42.2.10' testRuntime 'mysql:mysql-connector-java:8.0.19' testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.6.0' } From f79e79992f4fd1a23a1ade73748dde642419739c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 8 Feb 2020 20:23:14 +0000 Subject: [PATCH 26/45] =?UTF-8?q?Bump=20aws-java-sdk-logs=20from=201.11.63?= =?UTF-8?q?6=20to=201.11.718=20in=20/modules/lo=E2=80=A6=20(#2336)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [aws-java-sdk-logs](https://github.com/aws/aws-sdk-java) from 1.11.636 to 1.11.718. - [Release notes](https://github.com/aws/aws-sdk-java/releases) - [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java/compare/1.11.636...1.11.718) Signed-off-by: dependabot-preview[bot] --- modules/localstack/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/localstack/build.gradle b/modules/localstack/build.gradle index 81490d2dae..c1c12257ba 100644 --- a/modules/localstack/build.gradle +++ b/modules/localstack/build.gradle @@ -6,5 +6,5 @@ dependencies { compileOnly 'com.amazonaws:aws-java-sdk-s3:1.11.683' testCompile 'com.amazonaws:aws-java-sdk-s3:1.11.683' testCompile 'com.amazonaws:aws-java-sdk-sqs:1.11.636' - testCompile 'com.amazonaws:aws-java-sdk-logs:1.11.717' + testCompile 'com.amazonaws:aws-java-sdk-logs:1.11.718' } From 4172e56e977be38dfd0e59336e8fe16b5018b487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivo=20=C5=A0m=C3=ADd?= Date: Sun, 9 Feb 2020 20:34:02 +0100 Subject: [PATCH 27/45] checkMountableFile on Windows (#2296) --- .../java/org/testcontainers/utility/MountableFile.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/testcontainers/utility/MountableFile.java b/core/src/main/java/org/testcontainers/utility/MountableFile.java index 22939b0e1f..7b7367b929 100644 --- a/core/src/main/java/org/testcontainers/utility/MountableFile.java +++ b/core/src/main/java/org/testcontainers/utility/MountableFile.java @@ -242,7 +242,11 @@ private String extractClassPathResourceToTempLocation(final String hostPath) { // Mark temporary files/dirs for deletion at JVM shutdown deleteOnExit(tmpLocation.toPath()); - return tmpLocation.getAbsolutePath(); + try { + return tmpLocation.getCanonicalPath(); + } catch (IOException e) { + throw new IllegalStateException(e); + } } private File createTempDirectory() { @@ -371,8 +375,8 @@ public static int getUnixFileMode(final Path path) { try { int unixMode = (int) Files.readAttributes(path, "unix:mode").get("mode"); // Truncate mode bits for z/OS - if ("OS/390".equals(SystemUtils.OS_NAME) || - "z/OS".equals(SystemUtils.OS_NAME) || + if ("OS/390".equals(SystemUtils.OS_NAME) || + "z/OS".equals(SystemUtils.OS_NAME) || "zOS".equals(SystemUtils.OS_NAME) ) { unixMode &= TarConstants.MAXID; unixMode |= Files.isDirectory(path) ? 040000 : 0100000; From eb83d53d62c3175bdac4c679eabfd8e5439782cf Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 15 Feb 2020 16:20:29 +0000 Subject: [PATCH 28/45] =?UTF-8?q?Bump=20aws-java-sdk-logs=20from=201.11.71?= =?UTF-8?q?8=20to=201.11.722=20in=20/modules/lo=E2=80=A6=20(#2353)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [aws-java-sdk-logs](https://github.com/aws/aws-sdk-java) from 1.11.718 to 1.11.722. - [Release notes](https://github.com/aws/aws-sdk-java/releases) - [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-java/compare/1.11.718...1.11.722) Signed-off-by: dependabot-preview[bot] --- modules/localstack/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/localstack/build.gradle b/modules/localstack/build.gradle index c1c12257ba..2bdf076a68 100644 --- a/modules/localstack/build.gradle +++ b/modules/localstack/build.gradle @@ -6,5 +6,5 @@ dependencies { compileOnly 'com.amazonaws:aws-java-sdk-s3:1.11.683' testCompile 'com.amazonaws:aws-java-sdk-s3:1.11.683' testCompile 'com.amazonaws:aws-java-sdk-sqs:1.11.636' - testCompile 'com.amazonaws:aws-java-sdk-logs:1.11.718' + testCompile 'com.amazonaws:aws-java-sdk-logs:1.11.722' } From 03d52a5b8431bc24320603fe94b11202ffb24f03 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 15 Feb 2020 16:20:34 +0000 Subject: [PATCH 29/45] Bump tomcat-jdbc from 9.0.30 to 9.0.31 in /modules/mysql (#2344) Bumps tomcat-jdbc from 9.0.30 to 9.0.31. Signed-off-by: dependabot-preview[bot] --- modules/mysql/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mysql/build.gradle b/modules/mysql/build.gradle index 43867df521..11c522197b 100644 --- a/modules/mysql/build.gradle +++ b/modules/mysql/build.gradle @@ -5,7 +5,7 @@ dependencies { testCompile 'mysql:mysql-connector-java:8.0.19' testCompile 'com.zaxxer:HikariCP-java6:2.3.13' - testCompile 'org.apache.tomcat:tomcat-jdbc:9.0.30' + testCompile 'org.apache.tomcat:tomcat-jdbc:9.0.31' testCompile 'commons-dbutils:commons-dbutils:1.7' testCompile 'org.vibur:vibur-dbcp:25.0' } From 7b05552cee04a393e29992ecb5e6f389e9eb4723 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 15 Feb 2020 16:20:42 +0000 Subject: [PATCH 30/45] Bump tomcat-jdbc from 9.0.30 to 9.0.31 in /modules/mariadb (#2343) Bumps tomcat-jdbc from 9.0.30 to 9.0.31. Signed-off-by: dependabot-preview[bot] --- modules/mariadb/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mariadb/build.gradle b/modules/mariadb/build.gradle index c7d1dc9667..c479824ae4 100644 --- a/modules/mariadb/build.gradle +++ b/modules/mariadb/build.gradle @@ -6,6 +6,6 @@ dependencies { testCompile 'org.mariadb.jdbc:mariadb-java-client:2.5.4' testCompile 'com.zaxxer:HikariCP-java6:2.3.13' testCompile 'commons-dbutils:commons-dbutils:1.7' - testCompile 'org.apache.tomcat:tomcat-jdbc:9.0.30' + testCompile 'org.apache.tomcat:tomcat-jdbc:9.0.31' testCompile 'org.vibur:vibur-dbcp:25.0' } From 65f49a1ad6462a267c923b127c0a92c7a8168f92 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 15 Feb 2020 16:20:47 +0000 Subject: [PATCH 31/45] Bump postgresql from 42.2.9 to 42.2.10 in /examples (#2338) Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.2.9 to 42.2.10. - [Release notes](https://github.com/pgjdbc/pgjdbc/releases) - [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md) - [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.2.9...REL42.2.10) Signed-off-by: dependabot-preview[bot] --- examples/linked-container/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/linked-container/build.gradle b/examples/linked-container/build.gradle index f1977ea2c0..081b2ac04f 100644 --- a/examples/linked-container/build.gradle +++ b/examples/linked-container/build.gradle @@ -9,7 +9,7 @@ dependencies { compileOnly 'org.slf4j:slf4j-api:1.7.30' implementation 'com.squareup.okhttp3:okhttp:3.14.6' implementation 'org.json:json:20180813' - testImplementation 'org.postgresql:postgresql:42.2.9' + testImplementation 'org.postgresql:postgresql:42.2.10' testImplementation 'ch.qos.logback:logback-classic:1.2.3' testImplementation 'org.testcontainers:postgresql' } From d6e9776d77001bbff62225db81a1fca9e678eb46 Mon Sep 17 00:00:00 2001 From: nshipyakov <58605486+nshipyakov@users.noreply.github.com> Date: Sun, 16 Feb 2020 23:48:23 +0300 Subject: [PATCH 32/45] Kafka: replace deprecated poll method millis param with Duration (#2318) --- .../java/org/testcontainers/containers/KafkaContainerTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java b/modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java index add8b2b171..1490caa332 100644 --- a/modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java +++ b/modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java @@ -13,6 +13,7 @@ import org.junit.Test; import org.rnorth.ducttape.unreliables.Unreliables; +import java.time.Duration; import java.util.Arrays; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -100,7 +101,7 @@ protected void testKafkaFunctionality(String bootstrapServers) throws Exception producer.send(new ProducerRecord<>(topicName, "testcontainers", "rulezzz")).get(); Unreliables.retryUntilTrue(10, TimeUnit.SECONDS, () -> { - ConsumerRecords records = consumer.poll(100); + ConsumerRecords records = consumer.poll(Duration.ofMillis(100)); if (records.isEmpty()) { return false; From 4d60a3d8bd73fe07f3248a5a1d29cba1c669df66 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 16 Feb 2020 20:49:06 +0000 Subject: [PATCH 33/45] =?UTF-8?q?Bump=20elasticsearch-rest-client=20from?= =?UTF-8?q?=207.5.2=20to=207.6.0=20in=20/modules/=E2=80=A6=20(#2347)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [elasticsearch-rest-client](https://github.com/elastic/elasticsearch) from 7.5.2 to 7.6.0. - [Release notes](https://github.com/elastic/elasticsearch/releases) - [Commits](https://github.com/elastic/elasticsearch/compare/v7.5.2...v7.6.0) Signed-off-by: dependabot-preview[bot] --- modules/elasticsearch/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/elasticsearch/build.gradle b/modules/elasticsearch/build.gradle index 41d5b0f27a..17c34818a8 100644 --- a/modules/elasticsearch/build.gradle +++ b/modules/elasticsearch/build.gradle @@ -2,6 +2,6 @@ description = "TestContainers :: elasticsearch" dependencies { compile project(':testcontainers') - testCompile "org.elasticsearch.client:elasticsearch-rest-client:7.5.2" + testCompile "org.elasticsearch.client:elasticsearch-rest-client:7.6.0" testCompile "org.elasticsearch.client:transport:6.7.1" } From 0239bc366a7b6ac6bffbae7db92b8886e492d8fb Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 16 Feb 2020 20:49:39 +0000 Subject: [PATCH 34/45] Bump commons-compress from 1.19 to 1.20 in /core (#2337) Bumps commons-compress from 1.19 to 1.20. Signed-off-by: dependabot-preview[bot] --- core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/build.gradle b/core/build.gradle index 25aaa396a6..ab9b92115e 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -60,7 +60,7 @@ dependencies { compile 'org.slf4j:slf4j-api:1.7.30' compile 'org.jetbrains:annotations:17.0.0' compile 'javax.annotation:javax.annotation-api:1.3.2' - compile 'org.apache.commons:commons-compress:1.19' + compile 'org.apache.commons:commons-compress:1.20' // Added for JDK9 compatibility since it's missing this package compile 'javax.xml.bind:jaxb-api:2.3.1' compile ('org.rnorth.duct-tape:duct-tape:1.0.8') { From a9b46f67a1b7e8805566ab3b4cb20cd03577c773 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 16 Feb 2020 20:51:17 +0000 Subject: [PATCH 35/45] Bump okhttp from 3.14.4 to 3.14.6 in /core (#2243) Bumps [okhttp](https://github.com/square/okhttp) from 3.14.4 to 3.14.6. - [Release notes](https://github.com/square/okhttp/releases) - [Changelog](https://github.com/square/okhttp/blob/master/docs/changelog_3x.md) - [Commits](https://github.com/square/okhttp/compare/parent-3.14.4...parent-3.14.6) Signed-off-by: dependabot-preview[bot] --- core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/build.gradle b/core/build.gradle index ab9b92115e..1f76589a64 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -97,7 +97,7 @@ dependencies { shaded "org.yaml:snakeyaml:1.25" - shaded 'com.squareup.okhttp3:okhttp:3.14.4' + shaded 'com.squareup.okhttp3:okhttp:3.14.6' shaded 'org.glassfish.main.external:trilead-ssh2-repackaged:4.1.2' From cedd6fe9ca2b3714f8f877e3dc63af98c1052cad Mon Sep 17 00:00:00 2001 From: pertu Date: Sun, 16 Feb 2020 20:53:09 +0000 Subject: [PATCH 36/45] Set sourceJar.from=allSource for modules/spock (#2281) Fixes issue #2280 By default, sourceJar.from = allJava (see gradle/publishing.gradle) But Spock module is in Groovy => sourceJar.from should be allGroovy/allSource Co-authored-by: Richard North --- modules/spock/build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/spock/build.gradle b/modules/spock/build.gradle index c7b51cc9c5..074711d8bd 100644 --- a/modules/spock/build.gradle +++ b/modules/spock/build.gradle @@ -16,3 +16,9 @@ dependencies { testRuntime 'org.postgresql:postgresql:42.2.10' testRuntime 'mysql:mysql-connector-java:8.0.19' } + +sourceJar { + /* allJava is default (see gradle/publishing.gradle:sourceJar) + allSource contains both .java and .groovy files */ + from sourceSets.main.allSource +} From e8338819b0aca72fe577544df590bc8053ae5f34 Mon Sep 17 00:00:00 2001 From: Sergei Egorov Date: Mon, 24 Feb 2020 14:19:35 +0100 Subject: [PATCH 37/45] Prune images between module checks (#2376) --- azure-pipelines.yml | 4 +--- build.gradle | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4b060c5fce..68330550ee 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,9 +37,7 @@ jobs: inputs: gradleWrapperFile: 'gradlew' jdkVersionOption: '1.11' - options: '--continue -x testcontainers:check -x jdbc-test:check' + options: '--continue -x testcontainers:check -x jdbc-test:check -PpostCheckCommand="docker image prune -af"' tasks: 'check' publishJUnitResults: true testResultsFiles: '**/TEST-*.xml' - - diff --git a/build.gradle b/build.gradle index bac06d6405..c8b2267a04 100644 --- a/build.gradle +++ b/build.gradle @@ -71,6 +71,17 @@ subprojects { // Ensure that Javadoc generation is always tested check.dependsOn(javadoc) + def postCheckCommand = properties["postCheckCommand"] + if (postCheckCommand) { + check.finalizedBy(tasks.create("postCheckExec", Exec) { + if (org.gradle.internal.os.OperatingSystem.current().isWindows()) { + commandLine('cmd', '/c', postCheckCommand) + } else { + commandLine('sh', '-c', postCheckCommand) + } + }) + } + javadoc { dependsOn delombok source = delombok.outputs From ff79849e8ad31b918a34cbb20f4b86dbb2933f57 Mon Sep 17 00:00:00 2001 From: Richard North Date: Fri, 28 Feb 2020 09:53:31 +0000 Subject: [PATCH 38/45] =?UTF-8?q?Adding=20Windows=20Subsystem=20for=20Linu?= =?UTF-8?q?x=20section=20to=20the=20windows=20docum=E2=80=A6=20(#2282)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Luis Miguel MejĂ­a SuĂ¡rez Co-authored-by: Richard North Co-authored-by: Luis Miguel MejĂ­a SuĂ¡rez Co-authored-by: Kevin Wittek --- docs/contributing.md | 6 +++--- docs/supported_docker_environment/index.md | 1 + docs/supported_docker_environment/windows.md | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index 70cd452b14..7d87945c70 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -4,9 +4,9 @@ * Join our [Slack group](http://slack.testcontainers.org) * [Post an issue](https://github.com/testcontainers/testcontainers-java/issues) if you find any bugs * Contribute improvements or fixes using a [Pull Request](https://github.com/testcontainers/testcontainers-java/pulls). If you're going to contribute, thank you! Please just be sure to: - * discuss with the authors on an issue ticket prior to doing anything big - * follow the style, naming and structure conventions of the rest of the project - * make commits atomic and easy to merge + * discuss with the authors on an issue ticket prior to doing anything big. + * follow the style, naming and structure conventions of the rest of the project. + * make commits atomic and easy to merge. * when updating documentation, please see [our guidance for documentation contributions](contributing_docs.md). * verify all tests are passing. Build the project with `./gradlew check` to do this. **N.B.** Gradle's Build Cache is enabled by default, but you can add `--no-build-cache` flag to disable it. diff --git a/docs/supported_docker_environment/index.md b/docs/supported_docker_environment/index.md index 3477275c2f..7622a5051c 100644 --- a/docs/supported_docker_environment/index.md +++ b/docs/supported_docker_environment/index.md @@ -12,6 +12,7 @@ | Mac OS X - Docker for Mac | 1.12.0 | *Support is best-efforts at present*. `getTestHostIpAddress()` is [not currently supported](https://github.com/testcontainers/testcontainers-java/issues/166) due to limitations in Docker for Mac. | | Windows - Docker Toolbox | | *Support is limited at present and this is not currently tested on a regular basis*. | | Windows - Docker for Windows | | *Support is best-efforts at present.* Only Linux Containers (LCOW) are supported at the moment. See [Windows Support](windows.md) | +| Windows - Windows Subsystem for Linux (WSL) | Docker v17.06 | *Support is best-efforts at present.* Only Linux Containers (LCOW) are supported at the moment. See [Windows Support](windows.md). | ## Docker environment discovery diff --git a/docs/supported_docker_environment/windows.md b/docs/supported_docker_environment/windows.md index b35ee1aa2e..6365456b09 100644 --- a/docs/supported_docker_environment/windows.md +++ b/docs/supported_docker_environment/windows.md @@ -23,6 +23,25 @@ effort. * WCOW is currently not supported, since Testcontainers uses auxiliary Linux containers for certain tasks and Docker for Windows does not support hybrid engine mode at the time of writing. +## Windows Subsystem for Linux + +Testcontainers supports communicating with Docker for Windows within the Windows Subsystem for Linux *([**WSL**](https://docs.microsoft.com/en-us/windows/wsl/about))*. +The following additional configurations steps are required: + ++ Expose the Docker for Windows daemon on tcp port `2375` without **TLS**. + *(Right-click the Docker for Windows icon on the task bar, click setting and go to `General`)*. + ++ Set the `DOCKER_HOST` environment variable inside the **WSL** shell to `tcp://localhost:2375`. + It is recommended to add this to your `~/.bashrc` file, so it’s available every time you open your terminal. + ++ **Optional** - Only if volumes are required: + Inside the **WSL** shell, modify the `/ect/wsl.conf` file to mount the Windows drives on `/` instead of on `/mnt/`. + *(Reboot required after this step)*. + Remember to share the drives, on which you will store your volumes, with Docker for Windows. + *(Right-click the Docker for Windows icon on the task bar, click setting and go to `Shared Drives`)*. + +More information about running Docker within the **WSL** can be found [here](https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly). + ## Reporting issues Please report any issues with the Windows build of Testcontainers [here](https://github.com/testcontainers/testcontainers-java/issues) From 025b2840959573f681063aa3bfaf4b7f29cc3ee6 Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Thu, 30 Jul 2020 16:44:22 +0300 Subject: [PATCH 39/45] Trim all string based properties for testcontainers.properties --- .../utility/TestcontainersConfiguration.java | 21 ++++++++++--------- .../TestcontainersConfigurationTest.java | 4 ++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java b/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java index aa82957344..35dbe93d13 100644 --- a/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java +++ b/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java @@ -37,7 +37,8 @@ public class TestcontainersConfiguration { private static File ENVIRONMENT_CONFIG_FILE = new File(System.getProperty("user.home"), "." + PROPERTIES_FILE_NAME); @Getter(lazy = true) - private static final TestcontainersConfiguration instance = loadConfiguration();; + private static final TestcontainersConfiguration instance = loadConfiguration(); + ; @SuppressWarnings({"ConstantConditions", "unchecked", "rawtypes"}) @VisibleForTesting @@ -64,19 +65,19 @@ public String getAmbassadorContainerImage() { } public String getSocatContainerImage() { - return (String) properties.getOrDefault("socat.container.image", "alpine/socat:latest"); + return String.valueOf(properties.getOrDefault("socat.container.image", "alpine/socat:latest")); } public String getVncRecordedContainerImage() { - return (String) properties.getOrDefault("vncrecorder.container.image", "testcontainers/vnc-recorder:1.1.0"); + return String.valueOf(properties.getOrDefault("vncrecorder.container.image", "testcontainers/vnc-recorder:1.1.0")).trim(); } public String getDockerComposeContainerImage() { - return (String) properties.getOrDefault("compose.container.image", "docker/compose:1.24.1"); + return String.valueOf(properties.getOrDefault("compose.container.image", "docker/compose:1.24.1")).trim(); } public String getTinyImage() { - return (String) properties.getOrDefault("tinyimage.container.image", "alpine:3.5"); + return String.valueOf(properties.getOrDefault("tinyimage.container.image", "alpine:3.5")).trim(); } public boolean isRyukPrivileged() { @@ -84,11 +85,11 @@ public boolean isRyukPrivileged() { } public String getRyukImage() { - return (String) properties.getOrDefault("ryuk.container.image", "testcontainers/ryuk:0.3.0"); + return String.valueOf(properties.getOrDefault("ryuk.container.image", "testcontainers/ryuk:0.3.0")).trim(); } public String getSSHdImage() { - return (String) properties.getOrDefault("sshd.container.image", "testcontainers/sshd:1.0.0"); + return String.valueOf(properties.getOrDefault("sshd.container.image", "testcontainers/sshd:1.0.0")).trim(); } public Integer getRyukTimeout() { @@ -96,15 +97,15 @@ public Integer getRyukTimeout() { } public String getKafkaImage() { - return (String) properties.getOrDefault("kafka.container.image", "confluentinc/cp-kafka"); + return String.valueOf(properties.getOrDefault("kafka.container.image", "confluentinc/cp-kafka")).trim(); } public String getPulsarImage() { - return (String) properties.getOrDefault("pulsar.container.image", "apachepulsar/pulsar"); + return String.valueOf(properties.getOrDefault("pulsar.container.image", "apachepulsar/pulsar")).trim(); } public String getLocalStackImage() { - return (String) properties.getOrDefault("localstack.container.image", "localstack/localstack"); + return String.valueOf(properties.getOrDefault("localstack.container.image", "localstack/localstack")).trim(); } public boolean isDisableChecks() { diff --git a/core/src/test/java/org/testcontainers/utility/TestcontainersConfigurationTest.java b/core/src/test/java/org/testcontainers/utility/TestcontainersConfigurationTest.java index 49a378554f..d746922889 100644 --- a/core/src/test/java/org/testcontainers/utility/TestcontainersConfigurationTest.java +++ b/core/src/test/java/org/testcontainers/utility/TestcontainersConfigurationTest.java @@ -46,6 +46,10 @@ public void shouldReadReuseFromEnvironmentOnly() { environmentProperties.setProperty("testcontainers.reuse.enable", "true"); assertTrue("reuse enabled", newConfig().environmentSupportsReuse()); + + environmentProperties.setProperty("ryuk.container.image", " testcontainersofficial/ryuk:0.3.0 "); + assertEquals("Whitespaces still exists in image property", "testcontainersofficial/ryuk:0.3.0",newConfig().getRyukImage()); + } private TestcontainersConfiguration newConfig() { From 37137052c9a6de8876351f2341856a0512c45c62 Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Thu, 30 Jul 2020 16:50:10 +0300 Subject: [PATCH 40/45] cleaning up --- .../org/testcontainers/utility/TestcontainersConfiguration.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java b/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java index 35dbe93d13..ab1762a96a 100644 --- a/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java +++ b/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java @@ -38,7 +38,6 @@ public class TestcontainersConfiguration { @Getter(lazy = true) private static final TestcontainersConfiguration instance = loadConfiguration(); - ; @SuppressWarnings({"ConstantConditions", "unchecked", "rawtypes"}) @VisibleForTesting From bb5f94af82d8225b9a966fe2744fac09c3dbb059 Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Mon, 3 Aug 2020 10:15:55 +0300 Subject: [PATCH 41/45] PR comments adjustments --- .../org/testcontainers/utility/TestcontainersConfiguration.java | 2 +- .../testcontainers/utility/TestcontainersConfigurationTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java b/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java index ab1762a96a..e7e0918e5e 100644 --- a/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java +++ b/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java @@ -60,7 +60,7 @@ static AtomicReference getInstanceField() { @Deprecated public String getAmbassadorContainerImage() { - return (String) properties.getOrDefault("ambassador.container.image", "richnorth/ambassador:latest"); + return String.valueOf(properties.getOrDefault("ambassador.container.image", "richnorth/ambassador:latest")).trim(); } public String getSocatContainerImage() { diff --git a/core/src/test/java/org/testcontainers/utility/TestcontainersConfigurationTest.java b/core/src/test/java/org/testcontainers/utility/TestcontainersConfigurationTest.java index d746922889..f0b8fb36a3 100644 --- a/core/src/test/java/org/testcontainers/utility/TestcontainersConfigurationTest.java +++ b/core/src/test/java/org/testcontainers/utility/TestcontainersConfigurationTest.java @@ -48,7 +48,7 @@ public void shouldReadReuseFromEnvironmentOnly() { assertTrue("reuse enabled", newConfig().environmentSupportsReuse()); environmentProperties.setProperty("ryuk.container.image", " testcontainersofficial/ryuk:0.3.0 "); - assertEquals("Whitespaces still exists in image property", "testcontainersofficial/ryuk:0.3.0",newConfig().getRyukImage()); + assertEquals("trailing whitespace was not removed from image name property", "testcontainersofficial/ryuk:0.3.0",newConfig().getRyukImage()); } From 185fb116514c5c0f8197274e6c88ad7717e1b6e6 Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Tue, 11 Aug 2020 08:28:06 +0300 Subject: [PATCH 42/45] Move property trimming to configuration constructor --- .../utility/TestcontainersConfiguration.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java b/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java index e7e0918e5e..e6637505c2 100644 --- a/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java +++ b/core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java @@ -56,11 +56,13 @@ static AtomicReference getInstanceField() { this.properties.putAll(classpathProperties); this.properties.putAll(environmentProperties); + properties.keySet() + .forEach(key -> properties.replace(key, properties.getProperty(String.valueOf(key)).trim())); } @Deprecated public String getAmbassadorContainerImage() { - return String.valueOf(properties.getOrDefault("ambassador.container.image", "richnorth/ambassador:latest")).trim(); + return String.valueOf(properties.getOrDefault("ambassador.container.image", "richnorth/ambassador:latest")); } public String getSocatContainerImage() { @@ -68,15 +70,15 @@ public String getSocatContainerImage() { } public String getVncRecordedContainerImage() { - return String.valueOf(properties.getOrDefault("vncrecorder.container.image", "testcontainers/vnc-recorder:1.1.0")).trim(); + return String.valueOf(properties.getOrDefault("vncrecorder.container.image", "testcontainers/vnc-recorder:1.1.0")); } public String getDockerComposeContainerImage() { - return String.valueOf(properties.getOrDefault("compose.container.image", "docker/compose:1.24.1")).trim(); + return String.valueOf(properties.getOrDefault("compose.container.image", "docker/compose:1.24.1")); } public String getTinyImage() { - return String.valueOf(properties.getOrDefault("tinyimage.container.image", "alpine:3.5")).trim(); + return String.valueOf(properties.getOrDefault("tinyimage.container.image", "alpine:3.5")); } public boolean isRyukPrivileged() { @@ -84,11 +86,11 @@ public boolean isRyukPrivileged() { } public String getRyukImage() { - return String.valueOf(properties.getOrDefault("ryuk.container.image", "testcontainers/ryuk:0.3.0")).trim(); + return String.valueOf(properties.getOrDefault("ryuk.container.image", "testcontainers/ryuk:0.3.0")); } public String getSSHdImage() { - return String.valueOf(properties.getOrDefault("sshd.container.image", "testcontainers/sshd:1.0.0")).trim(); + return String.valueOf(properties.getOrDefault("sshd.container.image", "testcontainers/sshd:1.0.0")); } public Integer getRyukTimeout() { @@ -96,15 +98,15 @@ public Integer getRyukTimeout() { } public String getKafkaImage() { - return String.valueOf(properties.getOrDefault("kafka.container.image", "confluentinc/cp-kafka")).trim(); + return String.valueOf(properties.getOrDefault("kafka.container.image", "confluentinc/cp-kafka")); } public String getPulsarImage() { - return String.valueOf(properties.getOrDefault("pulsar.container.image", "apachepulsar/pulsar")).trim(); + return String.valueOf(properties.getOrDefault("pulsar.container.image", "apachepulsar/pulsar")); } public String getLocalStackImage() { - return String.valueOf(properties.getOrDefault("localstack.container.image", "localstack/localstack")).trim(); + return String.valueOf(properties.getOrDefault("localstack.container.image", "localstack/localstack")); } public boolean isDisableChecks() { From 4b0909bec10fdf257adc261381397365a1e9ea85 Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Mon, 10 Aug 2020 17:02:07 +0300 Subject: [PATCH 43/45] Removing jetbrains annotations dependencies --- core/build.gradle | 1 - .../FixedHostPortGenericContainer.java | 4 +-- .../containers/GenericContainer.java | 7 +--- ...umDurationRunningStartupCheckStrategy.java | 6 ++-- .../AuditLoggingDockerClient.java | 23 +++++++----- .../DockerClientProviderStrategy.java | 5 ++- .../RootlessDockerClientProviderStrategy.java | 2 -- .../dockerclient/TransportConfig.java | 2 -- .../testcontainers/utility/AuditLogger.java | 33 +++++++++-------- .../utility/AuthConfigUtil.java | 4 +-- .../testcontainers/utility/CommandLine.java | 4 +-- .../utility/ComparableVersion.java | 9 +++-- .../utility/DockerImageName.java | 6 ++-- .../testcontainers/utility/MountableFile.java | 16 ++++----- .../dockerclient/EventStreamTest.java | 4 +-- .../strategy/AbstractWaitStrategyTest.java | 4 +-- .../wait/strategy/HttpWaitStrategyTest.java | 4 +-- .../strategy/LogMessageWaitStrategyTest.java | 4 +-- .../MockTestcontainersConfigurationRule.java | 6 ++-- .../utility/MountableFileTest.java | 10 +++--- .../utility/RegistryAuthLocatorTest.java | 10 +++--- .../containers/MongoDbContainer.java | 6 ++-- .../containers/JdbcDatabaseContainer.java | 3 +- .../containers/MySQLContainer.java | 4 +-- .../containers/NginxContainer.java | 4 +-- .../containers/PostgreSQLContainer.java | 4 +-- .../containers/PrestoContainer.java | 4 +-- .../containers/RabbitMQContainer.java | 4 +-- .../containers/BrowserWebDriverContainer.java | 7 ++-- .../junit/BaseWebDriverContainerTest.java | 4 +-- .../spock/TestLifecycleAwareIT.groovy | 35 +++++++++---------- 31 files changed, 116 insertions(+), 123 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index 894990fe9a..03ada63291 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -164,7 +164,6 @@ dependencies { compile 'junit:junit:4.12' compile 'org.slf4j:slf4j-api:1.7.30' - compile 'org.jetbrains:annotations:19.0.0' compile 'org.apache.commons:commons-compress:1.20' compile ('org.rnorth.duct-tape:duct-tape:1.0.8') { exclude(group: 'org.jetbrains', module: 'annotations') diff --git a/core/src/main/java/org/testcontainers/containers/FixedHostPortGenericContainer.java b/core/src/main/java/org/testcontainers/containers/FixedHostPortGenericContainer.java index 6477c28042..3836941205 100644 --- a/core/src/main/java/org/testcontainers/containers/FixedHostPortGenericContainer.java +++ b/core/src/main/java/org/testcontainers/containers/FixedHostPortGenericContainer.java @@ -1,6 +1,6 @@ package org.testcontainers.containers; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; /** * Variant of {@link GenericContainer} that allows a fixed port on the docker host to be mapped to a container port. @@ -17,7 +17,7 @@ public class FixedHostPortGenericContainer> private int startupAttempts = 1; - @Nullable private String workingDirectory = null; /** * The shared memory size to use when starting the container. * This value is in bytes. */ - @Nullable private Long shmSize; // Maintain order in which entries are added, as earlier target location may be a prefix of a later location. @@ -701,7 +697,6 @@ protected Integer getLivenessCheckPort() { * @return the ports on which to check if the container is ready * @deprecated use {@link #getLivenessCheckPortNumbers()} instead */ - @NotNull @NonNull @Deprecated protected Set getLivenessCheckPorts() { diff --git a/core/src/main/java/org/testcontainers/containers/startupcheck/MinimumDurationRunningStartupCheckStrategy.java b/core/src/main/java/org/testcontainers/containers/startupcheck/MinimumDurationRunningStartupCheckStrategy.java index 3ce50446b7..b4012d8749 100644 --- a/core/src/main/java/org/testcontainers/containers/startupcheck/MinimumDurationRunningStartupCheckStrategy.java +++ b/core/src/main/java/org/testcontainers/containers/startupcheck/MinimumDurationRunningStartupCheckStrategy.java @@ -2,7 +2,7 @@ import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.command.InspectContainerResponse; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.testcontainers.utility.DockerStatus; import java.time.Duration; @@ -14,10 +14,10 @@ */ public class MinimumDurationRunningStartupCheckStrategy extends StartupCheckStrategy { - @NotNull + @NonNull private final Duration minimumRunningDuration; - public MinimumDurationRunningStartupCheckStrategy(@NotNull Duration minimumRunningDuration) { + public MinimumDurationRunningStartupCheckStrategy(@NonNull Duration minimumRunningDuration) { this.minimumRunningDuration = minimumRunningDuration; } diff --git a/core/src/main/java/org/testcontainers/dockerclient/AuditLoggingDockerClient.java b/core/src/main/java/org/testcontainers/dockerclient/AuditLoggingDockerClient.java index 2dc88cad31..551361a26b 100644 --- a/core/src/main/java/org/testcontainers/dockerclient/AuditLoggingDockerClient.java +++ b/core/src/main/java/org/testcontainers/dockerclient/AuditLoggingDockerClient.java @@ -1,10 +1,17 @@ package org.testcontainers.dockerclient; import com.github.dockerjava.api.DockerClient; -import com.github.dockerjava.api.command.*; +import com.github.dockerjava.api.command.CreateContainerCmd; +import com.github.dockerjava.api.command.CreateNetworkCmd; +import com.github.dockerjava.api.command.KillContainerCmd; +import com.github.dockerjava.api.command.RemoveContainerCmd; +import com.github.dockerjava.api.command.RemoveNetworkCmd; +import com.github.dockerjava.api.command.StartContainerCmd; +import com.github.dockerjava.api.command.StopContainerCmd; +import com.github.dockerjava.api.command.SyncDockerCmd; +import lombok.NonNull; import lombok.experimental.Delegate; import lombok.extern.slf4j.Slf4j; -import org.jetbrains.annotations.NotNull; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Proxy; @@ -29,7 +36,7 @@ public AuditLoggingDockerClient(DockerClient wrappedClient) { } @Override - public CreateContainerCmd createContainerCmd(@NotNull String image) { + public CreateContainerCmd createContainerCmd(@NonNull String image) { return wrappedCommand(CreateContainerCmd.class, wrappedClient.createContainerCmd(image), (cmd, res) -> doLog("CREATE", image, res.getId(), cmd), @@ -38,7 +45,7 @@ public CreateContainerCmd createContainerCmd(@NotNull String image) { } @Override - public StartContainerCmd startContainerCmd(@NotNull String containerId) { + public StartContainerCmd startContainerCmd(@NonNull String containerId) { return wrappedCommand(StartContainerCmd.class, wrappedClient.startContainerCmd(containerId), (cmd, res) -> doLog("START", null, containerId, cmd), @@ -46,7 +53,7 @@ public StartContainerCmd startContainerCmd(@NotNull String containerId) { } @Override - public RemoveContainerCmd removeContainerCmd(@NotNull String containerId) { + public RemoveContainerCmd removeContainerCmd(@NonNull String containerId) { return wrappedCommand(RemoveContainerCmd.class, wrappedClient.removeContainerCmd(containerId), (cmd, res) -> doLog("REMOVE", null, containerId, cmd), @@ -54,7 +61,7 @@ public RemoveContainerCmd removeContainerCmd(@NotNull String containerId) { } @Override - public StopContainerCmd stopContainerCmd(@NotNull String containerId) { + public StopContainerCmd stopContainerCmd(@NonNull String containerId) { return wrappedCommand(StopContainerCmd.class, wrappedClient.stopContainerCmd(containerId), (cmd, res) -> doLog("STOP", null, containerId, cmd), @@ -62,7 +69,7 @@ public StopContainerCmd stopContainerCmd(@NotNull String containerId) { } @Override - public KillContainerCmd killContainerCmd(@NotNull String containerId) { + public KillContainerCmd killContainerCmd(@NonNull String containerId) { return wrappedCommand(KillContainerCmd.class, wrappedClient.killContainerCmd(containerId), (cmd, res) -> doLog("KILL", null, containerId, cmd), @@ -78,7 +85,7 @@ public CreateNetworkCmd createNetworkCmd() { } @Override - public RemoveNetworkCmd removeNetworkCmd(@NotNull String networkId) { + public RemoveNetworkCmd removeNetworkCmd(@NonNull String networkId) { return wrappedCommand(RemoveNetworkCmd.class, wrappedClient.removeNetworkCmd(networkId), (cmd, res) -> doLog("REMOVE_NETWORK", null, null, cmd), diff --git a/core/src/main/java/org/testcontainers/dockerclient/DockerClientProviderStrategy.java b/core/src/main/java/org/testcontainers/dockerclient/DockerClientProviderStrategy.java index e21c75a581..8ed5838ef9 100644 --- a/core/src/main/java/org/testcontainers/dockerclient/DockerClientProviderStrategy.java +++ b/core/src/main/java/org/testcontainers/dockerclient/DockerClientProviderStrategy.java @@ -14,7 +14,6 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.jetbrains.annotations.Nullable; import org.rnorth.ducttape.TimeoutException; import org.rnorth.ducttape.ratelimits.RateLimiter; import org.rnorth.ducttape.ratelimits.RateLimiterBuilder; @@ -176,10 +175,10 @@ public static DockerClientProviderStrategy getFirstValidStrategy(List cmd) { + public static void doLog(@NonNull String action, + String image, + String containerId, + @NonNull DockerCmd cmd) { doLog(action, image, containerId, cmd, null); } - public static void doLog(@NotNull String action, - @Nullable String image, - @Nullable String containerId, - @NotNull DockerCmd cmd, - @Nullable Exception e) { + public static void doLog(@NonNull String action, + String image, + String containerId, + @NonNull DockerCmd cmd, + Exception e) { - if (! log.isTraceEnabled()) { + if (!log.isTraceEnabled()) { return; } @@ -69,10 +68,10 @@ public static void doLog(@NotNull String action, MDC.remove(MDC_PREFIX + ".Exception"); } - public static void doComposeLog(@NotNull String[] commandParts, - @Nullable List env) { + public static void doComposeLog(@NonNull String[] commandParts, + List env) { - if (! log.isTraceEnabled()) { + if (!log.isTraceEnabled()) { return; } diff --git a/core/src/main/java/org/testcontainers/utility/AuthConfigUtil.java b/core/src/main/java/org/testcontainers/utility/AuthConfigUtil.java index 77b670d374..4c951ac196 100644 --- a/core/src/main/java/org/testcontainers/utility/AuthConfigUtil.java +++ b/core/src/main/java/org/testcontainers/utility/AuthConfigUtil.java @@ -2,8 +2,8 @@ import com.github.dockerjava.api.model.AuthConfig; import com.google.common.base.MoreObjects; +import lombok.NonNull; import lombok.experimental.UtilityClass; -import org.jetbrains.annotations.NotNull; import static com.google.common.base.Strings.isNullOrEmpty; @@ -27,7 +27,7 @@ public static String toSafeString(AuthConfig authConfig) { .toString(); } - @NotNull + @NonNull private static String obfuscated(String value) { return isNullOrEmpty(value) ? "blank" : "hidden non-blank value"; } diff --git a/core/src/main/java/org/testcontainers/utility/CommandLine.java b/core/src/main/java/org/testcontainers/utility/CommandLine.java index a217823c40..c16814ee74 100644 --- a/core/src/main/java/org/testcontainers/utility/CommandLine.java +++ b/core/src/main/java/org/testcontainers/utility/CommandLine.java @@ -1,6 +1,6 @@ package org.testcontainers.utility; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.slf4j.Logger; import org.zeroturnaround.exec.InvalidExitValueException; import org.zeroturnaround.exec.ProcessExecutor; @@ -72,7 +72,7 @@ public static boolean executableExists(String executable) { return false; } - @NotNull + @NonNull public static String[] getSystemPath() { return System.getenv("PATH").split(Pattern.quote(File.pathSeparator)); } diff --git a/core/src/main/java/org/testcontainers/utility/ComparableVersion.java b/core/src/main/java/org/testcontainers/utility/ComparableVersion.java index d3e3d9eb95..67d3ce62ce 100644 --- a/core/src/main/java/org/testcontainers/utility/ComparableVersion.java +++ b/core/src/main/java/org/testcontainers/utility/ComparableVersion.java @@ -1,11 +1,10 @@ package org.testcontainers.utility; -import java.util.ArrayList; -import java.util.List; - import com.google.common.annotations.VisibleForTesting; +import lombok.NonNull; -import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; +import java.util.List; public final class ComparableVersion implements Comparable { @@ -18,7 +17,7 @@ public ComparableVersion(String version) { } @Override - public int compareTo(@NotNull ComparableVersion other) { + public int compareTo(@NonNull ComparableVersion other) { for (int i=0; i()).toString(), mode); } @@ -104,7 +104,7 @@ public static MountableFile forClasspathResource(@NotNull final String resourceN * @param mode octal value of posix file mode (000..777) * @return a {@link MountableFile} that may be used to obtain a mountable path */ - public static MountableFile forHostPath(@NotNull final String path, Integer mode) { + public static MountableFile forHostPath(@NonNull final String path, Integer mode) { return new MountableFile(new File(path).toURI().toString(), mode); } @@ -120,8 +120,8 @@ public static MountableFile forHostPath(final Path path, Integer mode) { } - @NotNull - private static URL getClasspathResource(@NotNull final String resourcePath, @NotNull final Set classLoaders) { + @NonNull + private static URL getClasspathResource(@NonNull final String resourcePath, @NonNull final Set classLoaders) { final Set classLoadersToSearch = new HashSet<>(classLoaders); // try context and system classloaders as well @@ -147,7 +147,7 @@ private static URL getClasspathResource(@NotNull final String resourcePath, @Not throw new IllegalArgumentException("Resource with path " + resourcePath + " could not be found on any of these classloaders: " + classLoadersToSearch); } - private static String unencodeResourceURIToFilePath(@NotNull final String resource) { + private static String unencodeResourceURIToFilePath(@NonNull final String resource) { try { // Convert any url-encoded characters (e.g. spaces) back into unencoded form return URLDecoder.decode(resource.replaceAll("\\+", "%2B"), Charsets.UTF_8.name()) diff --git a/core/src/test/java/org/testcontainers/dockerclient/EventStreamTest.java b/core/src/test/java/org/testcontainers/dockerclient/EventStreamTest.java index a43a001ca5..dd6b0b923d 100644 --- a/core/src/test/java/org/testcontainers/dockerclient/EventStreamTest.java +++ b/core/src/test/java/org/testcontainers/dockerclient/EventStreamTest.java @@ -3,7 +3,7 @@ import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.model.Event; import com.github.dockerjava.core.command.EventsResultCallback; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.junit.Rule; import org.junit.Test; import org.junit.rules.Timeout; @@ -49,7 +49,7 @@ public void test() throws IOException, InterruptedException { .withSince(Instant.parse(createdAt).getEpochSecond() + "") .exec(new EventsResultCallback() { @Override - public void onNext(@NotNull Event event) { + public void onNext(@NonNull Event event) { // Check that a create event for the container is received if (event.getId().equals(container.getContainerId()) && event.getStatus().equals("create")) { latch.countDown(); diff --git a/core/src/test/java/org/testcontainers/junit/wait/strategy/AbstractWaitStrategyTest.java b/core/src/test/java/org/testcontainers/junit/wait/strategy/AbstractWaitStrategyTest.java index 480536a54e..b42b606b4d 100644 --- a/core/src/test/java/org/testcontainers/junit/wait/strategy/AbstractWaitStrategyTest.java +++ b/core/src/test/java/org/testcontainers/junit/wait/strategy/AbstractWaitStrategyTest.java @@ -1,6 +1,6 @@ package org.testcontainers.junit.wait.strategy; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.junit.Before; import org.rnorth.ducttape.RetryCountExceededException; import org.rnorth.visibleassertions.VisibleAssertions; @@ -34,7 +34,7 @@ public abstract class AbstractWaitStrategyTest { * @param ready the AtomicBoolean on which to indicate success * @return WaitStrategy implementation */ - @NotNull + @NonNull protected abstract W buildWaitStrategy(final AtomicBoolean ready); @Before diff --git a/core/src/test/java/org/testcontainers/junit/wait/strategy/HttpWaitStrategyTest.java b/core/src/test/java/org/testcontainers/junit/wait/strategy/HttpWaitStrategyTest.java index e048f4bccb..74811f08d3 100644 --- a/core/src/test/java/org/testcontainers/junit/wait/strategy/HttpWaitStrategyTest.java +++ b/core/src/test/java/org/testcontainers/junit/wait/strategy/HttpWaitStrategyTest.java @@ -1,6 +1,6 @@ package org.testcontainers.junit.wait.strategy; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.junit.Test; import org.rnorth.ducttape.RetryCountExceededException; import org.testcontainers.containers.wait.strategy.HttpWaitStrategy; @@ -145,7 +145,7 @@ public void testWaitUntilReadyWithTimoutCausedByReadTimeout() { * @param ready the AtomicBoolean on which to indicate success * @return the WaitStrategy under test */ - @NotNull + @NonNull protected HttpWaitStrategy buildWaitStrategy(final AtomicBoolean ready) { return createHttpWaitStrategy(ready) .forResponsePredicate(s -> s.equals(GOOD_RESPONSE_BODY)); diff --git a/core/src/test/java/org/testcontainers/junit/wait/strategy/LogMessageWaitStrategyTest.java b/core/src/test/java/org/testcontainers/junit/wait/strategy/LogMessageWaitStrategyTest.java index a6ef9f11ba..606d2f0cf9 100644 --- a/core/src/test/java/org/testcontainers/junit/wait/strategy/LogMessageWaitStrategyTest.java +++ b/core/src/test/java/org/testcontainers/junit/wait/strategy/LogMessageWaitStrategyTest.java @@ -1,6 +1,6 @@ package org.testcontainers.junit.wait.strategy; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -46,7 +46,7 @@ public void testWaitUntilReady_Timeout() { "sleep 300"); } - @NotNull + @NonNull @Override protected LogMessageWaitStrategy buildWaitStrategy(AtomicBoolean ready) { diff --git a/core/src/test/java/org/testcontainers/utility/MockTestcontainersConfigurationRule.java b/core/src/test/java/org/testcontainers/utility/MockTestcontainersConfigurationRule.java index ba467f1389..06747d5ffc 100644 --- a/core/src/test/java/org/testcontainers/utility/MockTestcontainersConfigurationRule.java +++ b/core/src/test/java/org/testcontainers/utility/MockTestcontainersConfigurationRule.java @@ -1,6 +1,6 @@ package org.testcontainers.utility; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; @@ -16,9 +16,9 @@ public class MockTestcontainersConfigurationRule implements TestRule { static AtomicReference REF = TestcontainersConfiguration.getInstanceField(); - @NotNull + @NonNull @Override - public Statement apply(@NotNull Statement base, @NotNull Description description) { + public Statement apply(@NonNull Statement base, @NonNull Description description) { return new Statement() { @Override public void evaluate() throws Throwable { diff --git a/core/src/test/java/org/testcontainers/utility/MountableFileTest.java b/core/src/test/java/org/testcontainers/utility/MountableFileTest.java index c7dcaad290..ad24f04dc6 100644 --- a/core/src/test/java/org/testcontainers/utility/MountableFileTest.java +++ b/core/src/test/java/org/testcontainers/utility/MountableFileTest.java @@ -1,10 +1,10 @@ package org.testcontainers.utility; import lombok.Cleanup; +import lombok.NonNull; import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; -import org.jetbrains.annotations.NotNull; import org.junit.Test; import java.io.ByteArrayInputStream; @@ -15,7 +15,9 @@ import java.nio.file.Path; import java.util.function.Consumer; -import static org.rnorth.visibleassertions.VisibleAssertions.*; +import static org.rnorth.visibleassertions.VisibleAssertions.assertEquals; +import static org.rnorth.visibleassertions.VisibleAssertions.assertFalse; +import static org.rnorth.visibleassertions.VisibleAssertions.assertTrue; public class MountableFileTest { @@ -132,7 +134,7 @@ private TarArchiveInputStream intoTarArchive(Consumer co } @SuppressWarnings("ResultOfMethodCallIgnored") - @NotNull + @NonNull private Path createTempFile(final String name) throws IOException { final File tempParentDir = File.createTempFile("testcontainers", ""); tempParentDir.delete(); @@ -143,7 +145,7 @@ private Path createTempFile(final String name) throws IOException { return file; } - @NotNull + @NonNull private Path createTempDir() throws IOException { return Files.createTempDirectory("testcontainers"); } diff --git a/core/src/test/java/org/testcontainers/utility/RegistryAuthLocatorTest.java b/core/src/test/java/org/testcontainers/utility/RegistryAuthLocatorTest.java index a5e5ab4260..f4b34819aa 100644 --- a/core/src/test/java/org/testcontainers/utility/RegistryAuthLocatorTest.java +++ b/core/src/test/java/org/testcontainers/utility/RegistryAuthLocatorTest.java @@ -2,8 +2,8 @@ import com.github.dockerjava.api.model.AuthConfig; import com.google.common.io.Resources; +import lombok.NonNull; import org.apache.commons.lang.SystemUtils; -import org.jetbrains.annotations.NotNull; import org.junit.Test; import java.io.File; @@ -11,7 +11,9 @@ import java.util.HashMap; import java.util.Map; -import static org.rnorth.visibleassertions.VisibleAssertions.*; +import static org.rnorth.visibleassertions.VisibleAssertions.assertEquals; +import static org.rnorth.visibleassertions.VisibleAssertions.assertNotNull; +import static org.rnorth.visibleassertions.VisibleAssertions.assertNull; public class RegistryAuthLocatorTest { @Test @@ -130,12 +132,12 @@ public void lookupAuthConfigWithCredStoreEmpty() throws URISyntaxException { assertNull("CredStore field will be ignored, because value is blank", authConfig.getAuth()); } - @NotNull + @NonNull private RegistryAuthLocator createTestAuthLocator(String configName) throws URISyntaxException { return createTestAuthLocator(configName, new HashMap<>()); } - @NotNull + @NonNull private RegistryAuthLocator createTestAuthLocator(String configName, Map notFoundMessagesReference) throws URISyntaxException { final File configFile = new File(Resources.getResource("auth-config/" + configName).toURI()); diff --git a/examples/mongodb-container/src/test/java/org/testcontainers/containers/MongoDbContainer.java b/examples/mongodb-container/src/test/java/org/testcontainers/containers/MongoDbContainer.java index e44f2bb982..df614f3819 100644 --- a/examples/mongodb-container/src/test/java/org/testcontainers/containers/MongoDbContainer.java +++ b/examples/mongodb-container/src/test/java/org/testcontainers/containers/MongoDbContainer.java @@ -1,6 +1,6 @@ package org.testcontainers.containers; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.testcontainers.utility.DockerImageName; @@ -39,7 +39,7 @@ public MongoDbContainer() { * @deprecated use {@link MongoDbContainer(DockerImageName)} instead */ @Deprecated - public MongoDbContainer(@NotNull String image) { + public MongoDbContainer(@NonNull String image) { this(DockerImageName.parse(image)); } @@ -57,7 +57,7 @@ public MongoDbContainer(final DockerImageName dockerImageName) { * @return the public port of this container * @see #getMappedPort(int) */ - @NotNull + @NonNull public Integer getPort() { return getMappedPort(MONGODB_PORT); } diff --git a/modules/jdbc/src/main/java/org/testcontainers/containers/JdbcDatabaseContainer.java b/modules/jdbc/src/main/java/org/testcontainers/containers/JdbcDatabaseContainer.java index 4d1c4ece67..364b34c454 100644 --- a/modules/jdbc/src/main/java/org/testcontainers/containers/JdbcDatabaseContainer.java +++ b/modules/jdbc/src/main/java/org/testcontainers/containers/JdbcDatabaseContainer.java @@ -3,7 +3,6 @@ import com.github.dockerjava.api.command.InspectContainerResponse; import lombok.NonNull; import org.apache.commons.lang.StringUtils; -import org.jetbrains.annotations.NotNull; import org.testcontainers.containers.traits.LinkableContainer; import org.testcontainers.delegate.DatabaseDelegate; import org.testcontainers.ext.ScriptUtils; @@ -269,7 +268,7 @@ protected String constructUrlParameters(String startCharacter, String delimiter, return urlParameters; } - protected void optionallyMapResourceParameterAsVolume(@NotNull String paramName, @NotNull String pathNameInContainer, @NotNull String defaultResource) { + protected void optionallyMapResourceParameterAsVolume(@NonNull String paramName, @NonNull String pathNameInContainer, @NonNull String defaultResource) { String resourceName = parameters.getOrDefault(paramName, defaultResource); if (resourceName != null) { diff --git a/modules/mysql/src/main/java/org/testcontainers/containers/MySQLContainer.java b/modules/mysql/src/main/java/org/testcontainers/containers/MySQLContainer.java index 35321db5d7..080c24bfe6 100644 --- a/modules/mysql/src/main/java/org/testcontainers/containers/MySQLContainer.java +++ b/modules/mysql/src/main/java/org/testcontainers/containers/MySQLContainer.java @@ -1,6 +1,6 @@ package org.testcontainers.containers; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.testcontainers.utility.DockerImageName; import java.util.HashSet; @@ -48,7 +48,7 @@ public MySQLContainer(final DockerImageName dockerImageName) { } - @NotNull + @NonNull @Override protected Set getLivenessCheckPorts() { return new HashSet<>(getMappedPort(MYSQL_PORT)); diff --git a/modules/nginx/src/main/java/org/testcontainers/containers/NginxContainer.java b/modules/nginx/src/main/java/org/testcontainers/containers/NginxContainer.java index 75a4571b68..938cd751e3 100644 --- a/modules/nginx/src/main/java/org/testcontainers/containers/NginxContainer.java +++ b/modules/nginx/src/main/java/org/testcontainers/containers/NginxContainer.java @@ -1,6 +1,6 @@ package org.testcontainers.containers; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.testcontainers.containers.traits.LinkableContainer; import org.testcontainers.utility.DockerImageName; @@ -39,7 +39,7 @@ public NginxContainer(final DockerImageName dockerImageName) { super(dockerImageName); } - @NotNull + @NonNull @Override protected Set getLivenessCheckPorts() { return Collections.singleton(getMappedPort(80)); diff --git a/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java b/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java index b1ddb2a26e..218f5eda9a 100644 --- a/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java +++ b/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java @@ -1,6 +1,6 @@ package org.testcontainers.containers; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; import org.testcontainers.utility.DockerImageName; @@ -59,7 +59,7 @@ public PostgreSQLContainer(final DockerImageName dockerImageName) { addExposedPort(POSTGRESQL_PORT); } - @NotNull + @NonNull @Override protected Set getLivenessCheckPorts() { return new HashSet<>(getMappedPort(POSTGRESQL_PORT)); diff --git a/modules/presto/src/main/java/org/testcontainers/containers/PrestoContainer.java b/modules/presto/src/main/java/org/testcontainers/containers/PrestoContainer.java index 1c8c03ce4d..375b958f95 100644 --- a/modules/presto/src/main/java/org/testcontainers/containers/PrestoContainer.java +++ b/modules/presto/src/main/java/org/testcontainers/containers/PrestoContainer.java @@ -1,6 +1,6 @@ package org.testcontainers.containers; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; import org.testcontainers.utility.DockerImageName; @@ -49,7 +49,7 @@ public PrestoContainer(final DockerImageName dockerImageName) { addExposedPort(PRESTO_PORT); } - @NotNull + @NonNull @Override protected Set getLivenessCheckPorts() { return new HashSet<>(getMappedPort(PRESTO_PORT)); diff --git a/modules/rabbitmq/src/main/java/org/testcontainers/containers/RabbitMQContainer.java b/modules/rabbitmq/src/main/java/org/testcontainers/containers/RabbitMQContainer.java index a3b6134b29..35e0c59820 100644 --- a/modules/rabbitmq/src/main/java/org/testcontainers/containers/RabbitMQContainer.java +++ b/modules/rabbitmq/src/main/java/org/testcontainers/containers/RabbitMQContainer.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.dockerjava.api.command.InspectContainerResponse; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.utility.DockerImageName; import org.testcontainers.utility.MountableFile; @@ -411,7 +411,7 @@ public RabbitMQContainer withRabbitMQConfigErlang(MountableFile rabbitMQConf) { return withCopyFileToContainer(rabbitMQConf, "/etc/rabbitmq/rabbitmq-custom.config"); } - @NotNull + @NonNull private String toJson(Map arguments) { try { return new ObjectMapper().writeValueAsString(arguments); diff --git a/modules/selenium/src/main/java/org/testcontainers/containers/BrowserWebDriverContainer.java b/modules/selenium/src/main/java/org/testcontainers/containers/BrowserWebDriverContainer.java index f1cedab76a..5e8d8bfd1e 100644 --- a/modules/selenium/src/main/java/org/testcontainers/containers/BrowserWebDriverContainer.java +++ b/modules/selenium/src/main/java/org/testcontainers/containers/BrowserWebDriverContainer.java @@ -5,8 +5,7 @@ import com.github.dockerjava.api.model.Bind; import com.github.dockerjava.api.model.Volume; import com.google.common.collect.ImmutableSet; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import lombok.NonNull; import org.openqa.selenium.Capabilities; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.BrowserType; @@ -54,11 +53,9 @@ public class BrowserWebDriverContainer getLivenessCheckPorts() { Integer seleniumPort = getMappedPort(SELENIUM_PORT); diff --git a/modules/selenium/src/test/java/org/testcontainers/junit/BaseWebDriverContainerTest.java b/modules/selenium/src/test/java/org/testcontainers/junit/BaseWebDriverContainerTest.java index 0f41b2ce1d..9dc24c34e1 100644 --- a/modules/selenium/src/test/java/org/testcontainers/junit/BaseWebDriverContainerTest.java +++ b/modules/selenium/src/test/java/org/testcontainers/junit/BaseWebDriverContainerTest.java @@ -1,6 +1,6 @@ package org.testcontainers.junit; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebDriver; @@ -44,7 +44,7 @@ protected void assertBrowserNameIs(BrowserWebDriverContainer rule, String expect actual.equals(expectedName)); } - @NotNull + @NonNull private static RemoteWebDriver setupDriverFromRule(BrowserWebDriverContainer rule) { RemoteWebDriver driver = rule.getWebDriver(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); diff --git a/modules/spock/src/test/groovy/org/testcontainers/spock/TestLifecycleAwareIT.groovy b/modules/spock/src/test/groovy/org/testcontainers/spock/TestLifecycleAwareIT.groovy index 18f7517ea3..631dac6aac 100644 --- a/modules/spock/src/test/groovy/org/testcontainers/spock/TestLifecycleAwareIT.groovy +++ b/modules/spock/src/test/groovy/org/testcontainers/spock/TestLifecycleAwareIT.groovy @@ -1,6 +1,6 @@ package org.testcontainers.spock -import org.intellij.lang.annotations.Language + import spock.lang.Specification import spock.lang.Unroll import spock.util.EmbeddedSpecRunner @@ -11,8 +11,7 @@ class TestLifecycleAwareIT extends Specification { def "lifecycle awareness"() { given: - @Language("groovy") - String myTest = """ + String myTest = """ import org.testcontainers.spock.Testcontainers import org.testcontainers.containers.GenericContainer import spock.lang.Specification @@ -29,27 +28,27 @@ class TestLifecycleAwareIT extends Specification { } """ and: - def container = new TestLifecycleAwareContainerMock() - System.properties["org.testcontainers.container"] = container - System.properties["org.testcontainers.shouldFail"] = fails + def container = new TestLifecycleAwareContainerMock() + System.properties["org.testcontainers.container"] = container + System.properties["org.testcontainers.shouldFail"] = fails when: "executing the test" - def runner = new EmbeddedSpecRunner(throwFailure: false) - runner.run(myTest) + def runner = new EmbeddedSpecRunner(throwFailure: false) + runner.run(myTest) then: "mock container received lifecycle calls as expected" - container.lifecycleMethodCalls == ["beforeTest", "afterTest"] - container.lifecycleFilesystemFriendlyNames.join(",") == filesystemFriendlyNames - if (errorMessageStartsWith) { - assert container.capturedThrowable.message.startsWith(errorMessageStartsWith) - } else { - assert container.capturedThrowable == null - } + container.lifecycleMethodCalls == ["beforeTest", "afterTest"] + container.lifecycleFilesystemFriendlyNames.join(",") == filesystemFriendlyNames + if (errorMessageStartsWith) { + assert container.capturedThrowable.message.startsWith(errorMessageStartsWith) + } else { + assert container.capturedThrowable == null + } where: - fails | filesystemFriendlyNames | errorMessageStartsWith - false | 'TestLifecycleAwareIT-perform+test' | null - true | 'TestLifecycleAwareIT-perform+test' | "Condition not satisfied:" + fails | filesystemFriendlyNames | errorMessageStartsWith + false | 'TestLifecycleAwareIT-perform+test' | null + true | 'TestLifecycleAwareIT-perform+test' | "Condition not satisfied:" } } From b582b9e12729902b71e490521e05e9536d924bc0 Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Fri, 14 Aug 2020 15:40:26 +0300 Subject: [PATCH 44/45] Remove wrong import and nullable annotation --- .../java/org/testcontainers/containers/GenericContainer.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/src/main/java/org/testcontainers/containers/GenericContainer.java b/core/src/main/java/org/testcontainers/containers/GenericContainer.java index fddeb00a17..71455dcdae 100644 --- a/core/src/main/java/org/testcontainers/containers/GenericContainer.java +++ b/core/src/main/java/org/testcontainers/containers/GenericContainer.java @@ -20,7 +20,6 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.hash.Hashing; -import jdk.internal.jline.internal.Nullable; import lombok.AccessLevel; import lombok.Data; import lombok.NonNull; @@ -217,7 +216,6 @@ public class GenericContainer> .withConstantThroughput() .build(); - @Nullable private Map tmpFsMapping; @Setter(AccessLevel.NONE) From 41d0e8f5a6efb1c4ae7df1f9abff6c3e6bc2b8d4 Mon Sep 17 00:00:00 2001 From: "artjom.kalita" Date: Fri, 14 Aug 2020 15:57:59 +0300 Subject: [PATCH 45/45] remove exclusion for library where jetbrains.annotations was dependency --- core/build.gradle | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index 03ada63291..c7205edc97 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -165,9 +165,7 @@ dependencies { compile 'junit:junit:4.12' compile 'org.slf4j:slf4j-api:1.7.30' compile 'org.apache.commons:commons-compress:1.20' - compile ('org.rnorth.duct-tape:duct-tape:1.0.8') { - exclude(group: 'org.jetbrains', module: 'annotations') - } + compile ('org.rnorth.duct-tape:duct-tape:1.0.8') compile 'org.rnorth.visible-assertions:visible-assertions:2.1.2'