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

Add integ test for closure-based listeners in AbstractTestTask #26210

Merged

Conversation

abstratt
Copy link
Member

@abstratt abstratt commented Aug 29, 2023

...which were not working before 8.4.

Issue: #25311, #25983

@abstratt abstratt added this to the 8.4 RC1 milestone Aug 29, 2023
@abstratt abstratt requested a review from a team as a code owner August 29, 2023 19:58
@abstratt abstratt self-assigned this Aug 29, 2023
@abstratt abstratt requested a review from a team as a code owner August 29, 2023 19:58
@abstratt abstratt requested a review from big-guy August 29, 2023 19:58
@@ -72,4 +72,48 @@ abstract class AbstractJUnit4TestListenerIntegrationTest extends AbstractJUnitTe
assert containsLine(result.getOutput(), "START [Test testError(SomeTest)] [testError]")
assert containsLine(result.getOutput(), "FINISH [Test testError(SomeTest)] [testError] [java.lang.RuntimeException: message]")
}

def "can listen for test events using closures"() {
Copy link
Member Author

Choose a reason for hiding this comment

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

This now works in master, but it would fail with the CC-enabled executer in 8.3 (I applied this commit to a local copy of the release branch, and got this:

Condition not satisfied:

containsLine(result.getOutput(), "START [Test class SomeTest] [SomeTest]")
|            |      |
false        |      > Task :processTestResources NO-SOURCE
             |      > Task :processResources NO-SOURCE
             |      > Task :compileJava NO-SOURCE
             |      > Task :classes UP-TO-DATE
             |      > Task :compileTestJava
             |      > Task :testClasses
             |       
             |      > Task :test
             |       
             |      SomeTest > testError FAILED
             |          java.lang.RuntimeException at SomeTest.java:17
             |       
             |      SomeTest > testFail FAILED
             |          java.lang.AssertionError at SomeTest.java:15
             |      There were failing tests. See the report at: file:///Users/rafael/sources/gradle/trees/release/subprojects/testing-jvm/build/tmp/te%C5%9Dt%20files/JUnit4TestL.Test/t9b6w/build/reports/tests/test/index.html
             |       
             |      BUILD SUCCESSFUL in 823ms
             |      2 actionable tasks: 2 executed
             |      Configuration cache entry stored.
             <org.gradle.integtests.fixtures.executer.OutputScrapingExecutionResult@204b0f07 output=[> Task :processTestResources NO-SOURCE, > Task :processResources NO-SOURCE, > Task :compileJava NO-SOURCE, > Task :classes UP-TO-DATE, > Task :compileTestJava, > Task :testClasses, , > Task :test, , SomeTest > testError FAILED,     java.lang.RuntimeException at SomeTest.java:17, , SomeTest > testFail FAILED,     java.lang.AssertionError at SomeTest.java:15, There were failing tests. See the report at: file:///Users/rafael/sources/gradle/trees/release/subprojects/testing-jvm/build/tmp/te%C5%9Dt%20files/JUnit4TestL.Test/t9b6w/build/reports/tests/test/index.html, , BUILD SUCCESSFUL in 823ms, 2 actionable tasks: 2 executed, Configuration cache entry stored., ] error=[, 3 tests completed, 2 failed, ] includeBuildSrc=true mainContent=[> Task :processTestResources NO-SOURCE, > Task :processResources NO-SOURCE, > Task :compileJava NO-SOURCE, > Task :classes UP-TO-DATE, > Task :compileTestJava, > Task :testClasses, , > Task :test, , SomeTest > testError FAILED,     java.lang.RuntimeException at SomeTest.java:17, , SomeTest > testFail FAILED,     java.lang.AssertionError at SomeTest.java:15, There were failing tests. See the report at: file:///Users/rafael/sources/gradle/trees/release/subprojects/testing-jvm/build/tmp/te%C5%9Dt%20files/JUnit4TestL.Test/t9b6w/build/reports/tests/test/index.html, ] postBuild=[2 actionable tasks: 2 executed, Configuration cache entry stored., ] errorContent=[, 3 tests completed, 2 failed, ] groupedOutputFixture=null tasks=null>

	at org.gradle.testing.junit.junit4.AbstractJUnit4TestListenerIntegrationTest.can listen for test events using closures(AbstractJUnit4TestListenerIntegrationTest.groovy:110)

Copy link
Member Author

Choose a reason for hiding this comment

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

@tresat may still have some context on this from when he reviewed #25983

Copy link
Member

Choose a reason for hiding this comment

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

Does this mean the closure-based listeners aren't running at all? Are they broken?

Copy link
Member Author

Choose a reason for hiding this comment

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

Often, yes. It was very non-deterministic. We originally tried serialize/deserialize an object tree (ListenerBroadcast) that was built up lazily.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be clear, we are talking about configuration cache behavior.

@abstratt
Copy link
Member Author

@bot-gradle test and merge

@bot-gradle
Copy link
Collaborator

Your PR is queued. See the queue page for details.

@bot-gradle
Copy link
Collaborator

I've triggered a build for you. Click here to see all failures if there's any.

@bot-gradle bot-gradle merged commit 96b18af into master Aug 30, 2023
21 checks passed
@bot-gradle bot-gradle deleted the rchaves/master/integ-tests-for-test-task-listeners branch August 30, 2023 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants