Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pivotal ID # 186157290: Re execute test flaky itest #753

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 👍

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

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