From a369038c7022323ba19534a6143c1c05c43a430f Mon Sep 17 00:00:00 2001 From: Sergio del Amo Date: Mon, 19 Aug 2024 09:43:15 +0200 Subject: [PATCH] Micronaut Tests to latest versions (#1081) Disable tests which require docker if docker is not available. * Hamcrest 3.0 * JUnit5 5.11.0 #### Micronaut Modules ##### Micronaut Core * Micronaut Core 4.6.1 ##### Micronaut Serialization * Micronaut Serde 2.11.0 ##### Micronaut Data * Micronaut Data 4.9.0 ##### Micronaut Logging * Micronaut Logging 1.3.0 ##### Micronaut R2DBC * Micronaut R2DBC 5.6.1 ##### Micronaut Spring * Micronaut Spring 5.8.0 ##### Micronaut SQL * Micronaut SQL 5.8.1 ##### Micronaut Reactor * Micronaut Reactor 3.5.0 --- gradle/libs.versions.toml | 23 ++++++++++--------- test-suite-at-sql-jpa/build.gradle.kts | 2 ++ .../example/micronaut/ThreeProductsTest.java | 4 ++-- .../micronaut/TwoProductsEachTest.java | 2 ++ .../example/micronaut/TwoProductsTest.java | 2 ++ .../micronaut/TwoProductsThenNoneTest.java | 2 ++ test-suite-sql-r2dbc/build.gradle.kts | 3 ++- .../test/r2dbc/MySqlConnectionTest.java | 2 ++ 8 files changed, 26 insertions(+), 14 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cc1332868..531bb2d0d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,14 +1,14 @@ [versions] -micronaut = "4.5.4" +micronaut = "4.6.1" micronaut-platform = "4.5.1" micronaut-docs = "2.0.0" groovy = "4.0.15" managed-assertj = "3.26.3" -managed-hamcrest = "2.2" +managed-hamcrest = "3.0" managed-mockito = "5.12.0" managed-mockk = "1.13.12" -managed-junit = "5.10.3" +managed-junit = "5.11.0" managed-rest-assured = "5.5.0" managed-kotest = "5.9.1" managed-spock = "2.3-groovy-4.0" @@ -17,15 +17,15 @@ managed-bytebuddy = "1.14.19" kotlin = "1.9.25" graal-svm = "24.0.2" -micronaut-test = "4.3.0" -micronaut-data = "4.8.5" +micronaut-test = "4.4.0" +micronaut-data = "4.9.0" micronaut-hibernate-validator = "4.4.0" -micronaut-logging = "1.1.2" -micronaut-r2dbc = "5.5.0" -micronaut-serde = "2.10.2" -micronaut-spring = "5.7.0" -micronaut-sql = "5.7.0" -micronaut-reactor = "3.4.1" +micronaut-logging = "1.3.0" +micronaut-r2dbc = "5.6.1" +micronaut-serde = "2.11.0" +micronaut-spring = "5.8.0" +micronaut-sql = "5.8.1" +micronaut-reactor = "3.5.0" micronaut-test-resources = "2.5.4" micronaut-gradle-plugin = "4.4.2" @@ -62,6 +62,7 @@ managed-junit-vintage-engine = { module = "org.junit.vintage:junit-vintage-engin managed-bytebuddy = { module = "net.bytebuddy:byte-buddy", version.ref = "managed-bytebuddy" } managed-bytebuddy-agent = { module = "net.bytebuddy:byte-buddy-agent", version.ref = "managed-bytebuddy" } +testcontainers-junit-jupiter = { module = "org.testcontainers:junit-jupiter"} # BOMs boms-junit = { module = "org.junit:junit-bom", version.ref = "managed-junit" } boms-kotest = { module = "io.kotest:kotest-bom", version.ref = "managed-kotest" } diff --git a/test-suite-at-sql-jpa/build.gradle.kts b/test-suite-at-sql-jpa/build.gradle.kts index e9b52047b..432d35f29 100644 --- a/test-suite-at-sql-jpa/build.gradle.kts +++ b/test-suite-at-sql-jpa/build.gradle.kts @@ -21,6 +21,8 @@ dependencies { testImplementation(libs.managed.junit.jupiter.api) testImplementation(projects.micronautTestJunit5) testImplementation(mnTestResources.testcontainers.postgres) + testImplementation(platform(mnTestResources.boms.testcontainers)) + testImplementation(libs.testcontainers.junit.jupiter) testRuntimeOnly(libs.managed.junit.jupiter.engine) } diff --git a/test-suite-at-sql-jpa/src/test/java/example/micronaut/ThreeProductsTest.java b/test-suite-at-sql-jpa/src/test/java/example/micronaut/ThreeProductsTest.java index 8f110207a..01cfbe3ac 100644 --- a/test-suite-at-sql-jpa/src/test/java/example/micronaut/ThreeProductsTest.java +++ b/test-suite-at-sql-jpa/src/test/java/example/micronaut/ThreeProductsTest.java @@ -7,15 +7,15 @@ import io.micronaut.test.support.TestPropertyProvider; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; - import java.util.Map; - import static org.junit.jupiter.api.Assertions.assertEquals; +import org.testcontainers.junit.jupiter.Testcontainers; @Sql(scripts = "classpath:threeproducts.sql") @Sql(scripts = "classpath:rollbackthreeproducts.sql", phase = Sql.Phase.AFTER_ALL) @MicronautTest(startApplication = false) @TestInstance(TestInstance.Lifecycle.PER_CLASS) +@Testcontainers(disabledWithoutDocker = true) class ThreeProductsTest implements TestPropertyProvider { @Override diff --git a/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsEachTest.java b/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsEachTest.java index cffd88b10..2f5ba2839 100644 --- a/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsEachTest.java +++ b/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsEachTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.testcontainers.junit.jupiter.Testcontainers; import java.util.Map; @@ -16,6 +17,7 @@ @Sql(scripts = "classpath:rollbackallproducts.sql", phase = Sql.Phase.AFTER_ALL) @MicronautTest(startApplication = false) @TestInstance(TestInstance.Lifecycle.PER_CLASS) +@Testcontainers(disabledWithoutDocker = true) class TwoProductsEachTest implements TestPropertyProvider { @Override diff --git a/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsTest.java b/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsTest.java index d442d7c12..644bd6618 100644 --- a/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsTest.java +++ b/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsTest.java @@ -6,6 +6,7 @@ import io.micronaut.test.support.TestPropertyProvider; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.testcontainers.junit.jupiter.Testcontainers; import java.util.Map; @@ -15,6 +16,7 @@ @Sql(scripts = "classpath:rollbacktwoproducts.sql", phase = Sql.Phase.AFTER_ALL) @MicronautTest(startApplication = false) @TestInstance(TestInstance.Lifecycle.PER_CLASS) +@Testcontainers(disabledWithoutDocker = true) class TwoProductsTest implements TestPropertyProvider { @Override diff --git a/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsThenNoneTest.java b/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsThenNoneTest.java index 613ec8f60..37b081a66 100644 --- a/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsThenNoneTest.java +++ b/test-suite-at-sql-jpa/src/test/java/example/micronaut/TwoProductsThenNoneTest.java @@ -7,6 +7,7 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.testcontainers.junit.jupiter.Testcontainers; import java.util.Map; @@ -18,6 +19,7 @@ // end::rollback[] @MicronautTest(startApplication = false) @TestInstance(TestInstance.Lifecycle.PER_CLASS) +@Testcontainers(disabledWithoutDocker = true) class TwoProductsThenNoneTest implements TestPropertyProvider { @Override diff --git a/test-suite-sql-r2dbc/build.gradle.kts b/test-suite-sql-r2dbc/build.gradle.kts index a81064c11..96f2c18b3 100644 --- a/test-suite-sql-r2dbc/build.gradle.kts +++ b/test-suite-sql-r2dbc/build.gradle.kts @@ -24,7 +24,8 @@ dependencies { testRuntimeOnly(mnLogging.logback.classic) testRuntimeOnly(mnR2dbc.r2dbc.mysql) - + testImplementation(platform(mnTestResources.boms.testcontainers)) + testImplementation(libs.testcontainers.junit.jupiter) testResourcesService(mnSql.mysql.connector.java) } diff --git a/test-suite-sql-r2dbc/src/test/java/io/micronaut/test/r2dbc/MySqlConnectionTest.java b/test-suite-sql-r2dbc/src/test/java/io/micronaut/test/r2dbc/MySqlConnectionTest.java index 4afce0026..642e1ea5e 100644 --- a/test-suite-sql-r2dbc/src/test/java/io/micronaut/test/r2dbc/MySqlConnectionTest.java +++ b/test-suite-sql-r2dbc/src/test/java/io/micronaut/test/r2dbc/MySqlConnectionTest.java @@ -6,6 +6,7 @@ import io.r2dbc.spi.ConnectionFactory; import jakarta.inject.Inject; import org.junit.jupiter.api.Test; +import org.testcontainers.junit.jupiter.Testcontainers; import reactor.core.publisher.Flux; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -14,6 +15,7 @@ @MicronautTest @Property(name = "r2dbc.datasources.default.db-type", value = "mysql") @Sql(value = {"classpath:create.sql", "classpath:datasource_1_insert.sql"}, resourceType = ConnectionFactory.class) +@Testcontainers(disabledWithoutDocker = true) class MySqlConnectionTest { @Inject