Polish "Add liquibase test rollback on update property"

Closes gh-13159
This commit is contained in:
Stephane Nicoll 2018-05-14 16:14:11 +02:00
parent 08279c889c
commit c7eec5c45e
3 changed files with 14 additions and 11 deletions

View File

@ -203,4 +203,5 @@ public class LiquibaseProperties {
public void setTestRollbackOnUpdate(boolean testRollbackOnUpdate) {
this.testRollbackOnUpdate = testRollbackOnUpdate;
}
}

View File

@ -178,6 +178,18 @@ public class LiquibaseAutoConfigurationTests {
}));
}
@Test
public void overrideTestRollbackOnUpdate() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues(
"spring.liquibase.test-rollback-on-update:true")
.run((context) -> {
SpringLiquibase liquibase = context.getBean(SpringLiquibase.class);
assertThat(liquibase.isTestRollbackOnUpdate()).isTrue();
});
}
@Test
public void changeLogDoesNotExist() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
@ -238,17 +250,6 @@ public class LiquibaseAutoConfigurationTests {
});
}
@Test
public void testRollbackOnUpdate() throws IOException {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues(
"spring.liquibase.test-rollback-on-update:true")
.run((context) -> {
SpringLiquibase liquibase = context.getBean(SpringLiquibase.class);
assertThat(liquibase.isTestRollbackOnUpdate());
});
}
@Test
public void liquibaseDataSource() {
this.contextRunner.withUserConfiguration(LiquibaseDataSourceConfiguration.class,

View File

@ -567,6 +567,7 @@ content into your application. Rather, pick only the properties that you need.
spring.liquibase.parameters.*= # Change log parameters.
spring.liquibase.password= # Login password of the database to migrate.
spring.liquibase.rollback-file= # File to which rollback SQL is written when an update is performed.
spring.liquibase.test-rollback-on-update=false # Whether rollback should be tested before update is performed.
spring.liquibase.url= # JDBC URL of the database to migrate. If not set, the primary configured data source is used.
spring.liquibase.user= # Login user of the database to migrate.