From 6eba18fb688082466f6c67528df12f5c71d643c8 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 28 Jan 2025 11:45:28 +0100 Subject: [PATCH] tag LiquibaseCompatibilityIntegrationTest with officeIntegrationTest instead of importOfficeData and cleanup --- build.gradle | 12 ++++++------ .../LiquibaseCompatibilityIntegrationTest.java | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 6895942a..3f400c41 100644 --- a/build.gradle +++ b/build.gradle @@ -335,7 +335,7 @@ jacocoTestCoverageVerification { } } -// HOWTO: run all unit-tests which don't need a database: gw unitTest +// HOWTO: run all unit-tests which don't need a database: gw-test unitTest tasks.register('unitTest', Test) { useJUnitPlatform { excludeTags 'importOfficeData', 'importHostingAssets', 'scenarioTest', 'generalIntegrationTest', @@ -360,7 +360,7 @@ tasks.register('generalIntegrationTest', Test) { mustRunAfter spotlessJava } -// HOWTO: run all integration tests of the office module: gw officeIntegrationTest +// HOWTO: run all integration tests of the office module: gw-test officeIntegrationTest tasks.register('officeIntegrationTest', Test) { useJUnitPlatform { includeTags 'officeIntegrationTest' @@ -372,26 +372,26 @@ tasks.register('officeIntegrationTest', Test) { mustRunAfter spotlessJava } -// HOWTO: run all integration tests of the booking module: gw bookingIntegrationTest +// HOWTO: run all integration tests of the booking module: gw-test bookingIntegrationTest tasks.register('bookingIntegrationTest', Test) { useJUnitPlatform { includeTags 'bookingIntegrationTest' } group 'verification' - description 'runs integration tests of the office module' + description 'runs integration tests of the booking module' mustRunAfter spotlessJava } -// HOWTO: run all integration tests of the hosting module: gw hostingIntegrationTest +// HOWTO: run all integration tests of the hosting module: gw-test hostingIntegrationTest tasks.register('hostingIntegrationTest', Test) { useJUnitPlatform { includeTags 'hostingIntegrationTest' } group 'verification' - description 'runs integration tests of the office module' + description 'runs integration tests of the hosting module' mustRunAfter spotlessJava } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/LiquibaseCompatibilityIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/LiquibaseCompatibilityIntegrationTest.java index edffb33a..385594fd 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/LiquibaseCompatibilityIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/LiquibaseCompatibilityIntegrationTest.java @@ -12,7 +12,6 @@ import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.context.annotation.Import; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.jdbc.Sql; import javax.sql.DataSource; @@ -23,6 +22,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.BEFORE_TEST_CLASS; // TODO.impl: The reference-SQL-dump-generation needs to be automated +// BLOG: Liquibase-migration-test (not before the reference-SQL-dump-generation is simplified) // HOWTO: generate the prod-reference-SQL-dump during a prod-release /** @@ -70,13 +70,12 @@ import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.BEFORE_TE *

The generated dump has to be committed to git and will be used in future test-runs * until it gets replaced at the next release.

*/ -@Tag("importOfficeData") +@Tag("officeIntegrationTest") @DataJpaTest(properties = { "spring.liquibase.enabled=false" // @Sql should go first, Liquibase will be initialized programmatically }) -@ActiveProfiles({"only-office", "liquibase-migration-test"}) -@TestPropertySource(properties = "spring.liquibase.contexts=only-office") @DirtiesContext +@ActiveProfiles("liquibase-migration-test") @Import({ Context.class, JpaAttempt.class, LiquibaseConfig.class }) @Sql(value = "/db/prod-only-office-schema-with-test-data.sql", executionPhase = BEFORE_TEST_CLASS) public class LiquibaseCompatibilityIntegrationTest extends CsvDataImport {