Add liquibase smoke test
Closes gh-64
This commit is contained in:
@@ -23,6 +23,7 @@ smoke_tests:
|
||||
- flyway
|
||||
- hateoas
|
||||
- jdbc
|
||||
- liquibase
|
||||
- logging-log4j2
|
||||
- logging-logback
|
||||
- mail
|
||||
|
||||
1
liquibase/README.adoc
Normal file
1
liquibase/README.adoc
Normal file
@@ -0,0 +1 @@
|
||||
Tests if database migrations with Liquibase works
|
||||
19
liquibase/build.gradle
Normal file
19
liquibase/build.gradle
Normal file
@@ -0,0 +1,19 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot'
|
||||
id 'org.springframework.aot.smoke-test'
|
||||
id 'org.graalvm.buildtools.native'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
|
||||
implementation("org.springframework.boot:spring-boot-starter-jdbc")
|
||||
implementation("org.liquibase:liquibase-core")
|
||||
implementation(project(":aot-smoke-test-third-party-hints"))
|
||||
runtimeOnly("com.h2database:h2")
|
||||
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
|
||||
aotTestImplementation(project(":aot-smoke-test-support"))
|
||||
aotTestImplementation("org.awaitility:awaitility:4.2.0")
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.liquibase;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.smoketest.support.assertj.AssertableOutput;
|
||||
import org.springframework.aot.smoketest.support.junit.AotSmokeTest;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@AotSmokeTest
|
||||
class LiquibaseApplicationAotTests {
|
||||
|
||||
@Test
|
||||
void liquibaseRan(AssertableOutput output) {
|
||||
Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() -> {
|
||||
assertThat(output).hasSingleLineContaining(
|
||||
"ChangeSet classpath:/db/changelog/db.changelog-master.yaml::1::nvoxland ran successfully in ");
|
||||
assertThat(output).hasSingleLineContaining(
|
||||
"ChangeSet classpath:/db/changelog/db.changelog-master.yaml::2::nvoxland ran successfully in ");
|
||||
assertThat(output).hasSingleLineContaining(
|
||||
"ChangeSet classpath:/db/changelog/db.changelog-master.yaml::3::nvoxland ran successfully in ");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.example.liquibase;
|
||||
|
||||
import org.springframework.aot.smoketest.thirdpartyhints.HikariRuntimeHints;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ImportRuntimeHints;
|
||||
|
||||
@SpringBootApplication
|
||||
@ImportRuntimeHints(HikariRuntimeHints.class)
|
||||
public class LiquibaseApplication {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
SpringApplication.run(LiquibaseApplication.class, args);
|
||||
Thread.currentThread().join(); // To be able to measure memory consumption
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
databaseChangeLog:
|
||||
- preConditions:
|
||||
|
||||
- changeSet:
|
||||
id: 1
|
||||
author: nvoxland
|
||||
changes:
|
||||
- createTable:
|
||||
tableName: person
|
||||
columns:
|
||||
- column:
|
||||
name: id
|
||||
type: int
|
||||
autoIncrement: true
|
||||
constraints:
|
||||
primaryKey: true
|
||||
nullable: false
|
||||
- column:
|
||||
name: firstname
|
||||
type: varchar(50)
|
||||
- column:
|
||||
name: lastname
|
||||
type: varchar(50)
|
||||
constraints:
|
||||
nullable: false
|
||||
- column:
|
||||
name: state
|
||||
type: char(2)
|
||||
|
||||
- changeSet:
|
||||
id: 2
|
||||
author: nvoxland
|
||||
changes:
|
||||
- addColumn:
|
||||
tableName: person
|
||||
columns:
|
||||
- column:
|
||||
name: username
|
||||
type: varchar(8)
|
||||
|
||||
- changeSet:
|
||||
id: 3
|
||||
author: nvoxland
|
||||
changes:
|
||||
- addLookupTable:
|
||||
existingTableName: person
|
||||
existingColumnName: state
|
||||
newTableName: state
|
||||
newColumnName: id
|
||||
newColumnDataType: char(2)
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.example.liquibase;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class LiquibaseApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,6 +51,7 @@ include "event-listener"
|
||||
include "flyway"
|
||||
include "hateoas"
|
||||
include "jdbc"
|
||||
include "liquibase"
|
||||
include "logging-log4j2"
|
||||
include "logging-logback"
|
||||
include "mail"
|
||||
|
||||
Reference in New Issue
Block a user