Move SQL test files

This commit is contained in:
2021-03-20 04:23:31 +01:00
parent 29d4d6ec25
commit f458d7b674
17 changed files with 14 additions and 12 deletions

2
.idea/dataSources.xml generated
View File

@@ -11,7 +11,7 @@
<driver-ref>postgresql</driver-ref> <driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize> <synchronize>true</synchronize>
<jdbc-driver>org.postgresql.Driver</jdbc-driver> <jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://localhost:5433/test</jdbc-url> <jdbc-url>jdbc:postgresql://localhost:15432/test</jdbc-url>
</data-source> </data-source>
<data-source source="LOCAL" name="sonar@localhost" uuid="ee78beab-120d-4740-ad21-d4d9e2121d25"> <data-source source="LOCAL" name="sonar@localhost" uuid="ee78beab-120d-4740-ad21-d4d9e2121d25">
<driver-ref>postgresql</driver-ref> <driver-ref>postgresql</driver-ref>

View File

@@ -71,7 +71,7 @@ val migration by tasks.registering {
dependsOn(tasks.named("composeUp")) dependsOn(tasks.named("composeUp"))
doLast { doLast {
val config = ConfigFactory.parseFile(file("$buildDir/../src/main/resources/application.conf")).resolve() val config = ConfigFactory.parseFile(file("$buildDir/resources/main/application.conf")).resolve()
val connection = Connection( val connection = Connection(
host = config.getString("db.host"), host = config.getString("db.host"),
port = config.getInt("db.port"), port = config.getInt("db.port"),
@@ -81,8 +81,8 @@ val migration by tasks.registering {
) )
Migrations( Migrations(
connection, connection,
file("$buildDir/../src/main/resources/sql/migrations").toURI(), file("$buildDir/resources/main/sql/migrations").toURI(),
file("$buildDir/../src/main/resources/sql/functions").toURI() file("$buildDir/resources/main/sql/functions").toURI()
).run { ).run {
run() run()
} }
@@ -94,7 +94,7 @@ val migrationTest by tasks.registering {
dependsOn(tasks.named("testComposeUp")) dependsOn(tasks.named("testComposeUp"))
finalizedBy(tasks.named("testComposeDown")) finalizedBy(tasks.named("testComposeDown"))
doLast { doLast {
val config = ConfigFactory.parseFile(file("$buildDir/../src/test/resources/application-test.conf")).resolve() val config = ConfigFactory.parseFile(file("$buildDir/resources/test/application-test.conf")).resolve()
val connection = Connection( val connection = Connection(
host = config.getString("db.host"), host = config.getString("db.host"),
port = config.getInt("db.port"), port = config.getInt("db.port"),
@@ -104,8 +104,8 @@ val migrationTest by tasks.registering {
) )
Migrations( Migrations(
connection, connection,
file("$buildDir/../src/main/resources/sql/migrations").toURI(), file("$buildDir/resources/main/sql/migrations").toURI(),
file("$buildDir/../src/main/resources/sql/functions").toURI() file("$buildDir/resources/main/sql/functions").toURI()
).run { ).run {
run() run()
connection.disconnect() connection.disconnect()
@@ -115,11 +115,13 @@ val migrationTest by tasks.registering {
val testSql by tasks.registering { val testSql by tasks.registering {
group = "verification" group = "verification"
dependsOn(tasks.named("processResources"))
dependsOn(tasks.named("processTestResources"))
dependsOn(tasks.named("testComposeUp")) dependsOn(tasks.named("testComposeUp"))
finalizedBy(tasks.named("testComposeDown")) finalizedBy(tasks.named("testComposeDown"))
doLast { doLast {
val config = ConfigFactory.parseFile(file("$buildDir/../src/test/resources/application-test.conf")).resolve() val config = ConfigFactory.parseFile(file("$buildDir/resources/test/application-test.conf")).resolve()
val connection = Connection( val connection = Connection(
host = config.getString("db.host"), host = config.getString("db.host"),
@@ -131,16 +133,16 @@ val testSql by tasks.registering {
Migrations( Migrations(
connection, connection,
file("$buildDir/../src/main/resources/sql/migrations").toURI(), file("$buildDir/resources/main/sql/migrations").toURI(),
file("$buildDir/../src/main/resources/sql/functions").toURI(), file("$buildDir/resources/main/sql/functions").toURI(),
file("$buildDir/../src/test/sql/fixtures").toURI() file("$buildDir/resources/test/sql/fixtures").toURI()
).run { ).run {
run() run()
} }
Requester.RequesterFactory( Requester.RequesterFactory(
connection = connection, connection = connection,
queriesDirectory = file("$buildDir/../src/test/sql").toURI() queriesDirectory = file("$buildDir/resources/test/sql").toURI()
).createRequester().run { ).createRequester().run {
getQueries().map { getQueries().map {
try { try {