fix profile for other tests
This commit is contained in:
parent
8ba4c870b3
commit
9a991c95e7
@ -17,6 +17,7 @@ import static net.hostsharing.hsadminng.config.HttpHeadersBuilder.headers;
|
||||
import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static com.github.tomakehurst.wiremock.client.WireMock.*;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@TestPropertySource(properties = {"server.port=0", "hsadminng.cas.server=http://localhost:8088/cas"})
|
||||
@ActiveProfiles("wiremock") // IMPORTANT: To test prod config, do not use test profile!
|
||||
|
@ -74,14 +74,14 @@ import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.BEFORE_TE
|
||||
@DataJpaTest(properties = {
|
||||
"spring.liquibase.enabled=false" // @Sql should go first, Liquibase will be initialized programmatically
|
||||
})
|
||||
@ActiveProfiles("only-office")
|
||||
@ActiveProfiles({"only-office", "liquibase-migration-test"})
|
||||
@TestPropertySource(properties = "spring.liquibase.contexts=only-office")
|
||||
@DirtiesContext
|
||||
@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 {
|
||||
|
||||
private static final String EXPECTED_CHANGESET = "hs-hosting-SCHEMA";
|
||||
private static final String EXPECTED_CHANGESET_ONLY_AFTER_NEW_MIGRATION = "hs-hosting-SCHEMA";
|
||||
private static int initialChangeSetCount = 0;
|
||||
|
||||
@Autowired
|
||||
@ -100,7 +100,7 @@ public class LiquibaseCompatibilityIntegrationTest extends CsvDataImport {
|
||||
void test() {
|
||||
final var liquibaseScripts = singleColumnSqlQuery("SELECT id FROM public.databasechangelog");
|
||||
assertThat(liquibaseScripts).hasSizeGreaterThan(initialChangeSetCount);
|
||||
assertThat(liquibaseScripts).contains(EXPECTED_CHANGESET);
|
||||
assertThat(liquibaseScripts).contains(EXPECTED_CHANGESET_ONLY_AFTER_NEW_MIGRATION);
|
||||
}
|
||||
|
||||
private void assertThatDatabaseIsInitialized() {
|
||||
@ -109,7 +109,7 @@ public class LiquibaseCompatibilityIntegrationTest extends CsvDataImport {
|
||||
|
||||
final var liquibaseScripts = singleColumnSqlQuery("SELECT * FROM public.databasechangelog");
|
||||
assertThat(liquibaseScripts).hasSizeGreaterThan(285);
|
||||
assertThat(liquibaseScripts).doesNotContain(EXPECTED_CHANGESET);
|
||||
assertThat(liquibaseScripts).doesNotContain(EXPECTED_CHANGESET_ONLY_AFTER_NEW_MIGRATION);
|
||||
initialChangeSetCount = liquibaseScripts.size();
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,12 @@ import liquibase.database.jvm.JdbcConnection;
|
||||
import liquibase.resource.ClassLoaderResourceAccessor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
@Profile("liquibase-migration-test")
|
||||
public class LiquibaseConfig {
|
||||
|
||||
@Bean
|
||||
|
Loading…
x
Reference in New Issue
Block a user