Skip to content

Commit

Permalink
Fix dependencies in integration tests (#487)
Browse files Browse the repository at this point in the history
### What's done:
* Fix dependencies in integration tests
  • Loading branch information
kgevorkyan authored Feb 8, 2023
1 parent 542bf1a commit daf00e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 5 additions & 2 deletions save-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ kotlin {

linkProperExecutable(os)

tasks.withType<Test>().configureEach {
// couldn't use just type `Test`,
// since `Test` and `KotlinNativeTest` are actually different classes,
// but both inherited from `AbstractTestTask`
tasks.withType<AbstractTestTask>().configureEach {
dependsOn(":save-core:downloadTestResources")
finalizedBy(":save-core:cleanupTestResources")
}
}

Expand Down Expand Up @@ -100,7 +104,6 @@ fun linkProperExecutable(os: DefaultOperatingSystem) {
if (enabledExecutables != null && enabledExecutables != "all") {
linkReleaseExecutableTaskProvider.enabled = false
}

// Integration test should be able to have access to binary during the execution. Also we use here the debug version,
// in aim to have ability to run it in CI, which operates only with debug versions
tasks.getByName("jvmTest").dependsOn(tasks.getByName(
Expand Down
10 changes: 7 additions & 3 deletions save-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,19 @@ tasks.register<Download>("downloadTestResources") {
}
}

// couldn't use just type `Test`,
// since `Test` and `KotlinNativeTest` are actually different classes,
// but both inherited from `AbstractTestTask`

val cleanupTask = tasks.register("cleanupTestResources") {
this.dependsOn(":save-cli:jvmTest")
mustRunAfter(tasks.withType<Test>())
mustRunAfter(tasks.withType<AbstractTestTask>())
doFirst {
file("../examples/kotlin-diktat/ktlint").delete()
file("../examples/kotlin-diktat/diktat.jar").delete()
}
}
tasks.withType<Test>().configureEach {

tasks.withType<AbstractTestTask>().configureEach {
dependsOn("downloadTestResources")
finalizedBy("cleanupTestResources")
}

0 comments on commit daf00e5

Please sign in to comment.