Skip to content

Commit

Permalink
Pivotal ID # 186157290: Re execute test flaky itest (#753)
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan-EBI authored Oct 2, 2023
1 parent 984a157 commit a8eddbe
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 41 deletions.
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/Plugins.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ object PluginVersions {
const val SshVersion = "2.10.1"
const val SpringBootPluginVersion = "2.7.1"
const val SpringDependencyManagementPluginVersion = "1.0.12.RELEASE"
const val GradleRetryVersion = "1.5.5"
}

object Plugins {
Expand All @@ -25,4 +26,5 @@ object Plugins {
const val SshPlugin = "org.hidetake.ssh"
const val SpringBootPlugin = "org.springframework.boot"
const val SpringDependencyManagementPlugin = "io.spring.dependency-management"
const val GradleRetry = "org.gradle.test-retry"
}
37 changes: 0 additions & 37 deletions gradle/itest.gradle.kts

This file was deleted.

45 changes: 41 additions & 4 deletions submission/submission-webapp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import TestDependencies.XmlUnitMatchers
import TestDependencies.rabitMqMock
import TestDependencies.slf4jApi
import TestDependencies.slf4jImp
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.springframework.boot.gradle.tasks.bundling.BootJar

buildscript {
Expand All @@ -71,6 +72,7 @@ plugins {
id(Plugins.KotlinAllOpenPlugin) version PluginVersions.KotlinPluginVersion
id(Plugins.SpringBootPlugin) version PluginVersions.SpringBootPluginVersion
id(Plugins.SpringDependencyManagementPlugin) version PluginVersions.SpringDependencyManagementPluginVersion
id(Plugins.GradleRetry) version PluginVersions.GradleRetryVersion
}

allOpen {
Expand Down Expand Up @@ -148,14 +150,49 @@ dependencies {
testImplementation(KotlinCoroutinesTest)
}

apply(from = "$rootDir/gradle/itest.gradle.kts")

tasks.named<BootJar>("bootJar") {
archiveBaseName.set("submission-webapp")
archiveVersion.set("1.0.0")
dependsOn("generateGitProperties")
}

tasks.named<Copy>("processItestResources") {
duplicatesStrategy = DuplicatesStrategy.WARN
sourceSets {
create("itest") {
java.srcDir(file("src/itest/java"))
resources.srcDir(file("src/itest/resources"))
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
runtimeClasspath += output + sourceSets["main"].output + compileClasspath
}
}

val copySqlSchema = tasks.create<Copy>("copySqlSchema") {
from("$rootDir/infrastructure/src/main/resources/setup/mysql/Schema.sql")
into("$buildDir/resources/itest")
}

val itest = tasks.create<Test>("itest") {
dependsOn(copySqlSchema)
testClassesDirs = sourceSets["itest"].output.classesDirs
classpath = sourceSets["itest"].runtimeClasspath

val enableFire = project.property("enableFire")!!
println("##### Running integration tests with fireEnable=$enableFire #######")
systemProperty("enableFire", enableFire)

useJUnitPlatform()
testLogging.exceptionFormat = TestExceptionFormat.FULL
testLogging.showStandardStreams = true
extensions.configure(JacocoTaskExtension::class) {
setDestinationFile(file("$buildDir/jacoco/jacocoITest.exec"))
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}

retry {
maxRetries.set(3)
maxFailures.set(10)
failOnPassedAfterRetry.set(false)
}
}

tasks.getByName<JacocoCoverageVerification>("jacocoTestCoverageVerification") { dependsOn(itest) }
tasks.named<Copy>("processItestResources") { duplicatesStrategy = DuplicatesStrategy.WARN }

0 comments on commit a8eddbe

Please sign in to comment.