-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-17479 Fix ignoreFailures logic in CI workflow [3/n] #17106
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -470,8 +470,11 @@ subprojects { | |
| def testsToExclude = ['**/*Suite.class'] | ||
|
|
||
| test { | ||
| ext { | ||
| hadFailure = false // Used to track if any tests failed, see afterSuite below | ||
| } | ||
| maxParallelForks = maxTestForks | ||
| ignoreFailures = userIgnoreFailures | ||
| ignoreFailures = true | ||
|
|
||
| maxHeapSize = defaultMaxHeapSize | ||
| jvmArgs = defaultJvmArgs | ||
|
|
@@ -499,6 +502,32 @@ subprojects { | |
| maxFailures = userMaxTestRetryFailures | ||
| } | ||
| } | ||
|
|
||
| // As we process results, check if there were any test failures. | ||
| afterSuite { desc, result -> | ||
| if (result.resultType == TestResult.ResultType.FAILURE) { | ||
| ext.hadFailure = true | ||
| } | ||
| } | ||
|
|
||
| // This closure will copy JUnit XML files out of the sub-project's build directory and into | ||
| // a top-level build/junit-xml directory. This is necessary to avoid reporting on tests which | ||
| // were not run, but instead were restored via FROM-CACHE. See KAFKA-17479 for more details. | ||
| // | ||
| // This closure will not run if a test fails and ignoreFailures is not true. | ||
|
mumrah marked this conversation as resolved.
Outdated
|
||
| doLast { | ||
| def dest = rootProject.layout.buildDirectory.dir("junit-xml/${project.name}").get().asFile | ||
| println "Copy JUnit XML for ${project.name} to $dest" | ||
| ant.copy(todir: "$dest") { | ||
| ant.fileset(dir: "${test.reports.junitXml.entryPoint}") | ||
| } | ||
|
|
||
| // If there were any test failures, we want to fail the task to prevent the failures | ||
| // from being cached. | ||
| if (ext.hadFailure) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we honor the "ignoreFailures=true" in this condition?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, you have fixed it 😄
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😄 I was thinking the same. I just pushed an update to preserve the existing |
||
| throw new GradleException("Failing this task since '${project.name}:${name}' had test failures.") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| task integrationTest(type: Test, dependsOn: compileJava) { | ||
|
|
@@ -569,14 +598,6 @@ subprojects { | |
| delete t.reports.junitXml.outputLocation | ||
| delete t.reports.html.outputLocation | ||
| } | ||
|
|
||
| doLast { | ||
| def dest = rootProject.layout.buildDirectory.dir("junit-xml/${project.name}").get().asFile | ||
| println "Copy JUnit XML for ${project.name} to $dest" | ||
| ant.copy(todir: "$dest") { | ||
| ant.fileset(dir: "${test.reports.junitXml.entryPoint}") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| jar { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.