Update JUnit4 instrumentation to fire test suite events for Bazel#11322
Conversation
Test Environment - sbt-scalatestJob Status: success
|
Test Environment - nebula-release-pluginJob Status: success
|
Test Environment - netflix-zuulJob Status: success
|
Test Environment - pass4sJob Status: failed
|
Test Environment - reactive-streams-jvmJob Status: success
|
Test Environment - sonar-kotlinJob Status: success
|
Test Environment - jolokiaJob Status: success
|
Test Environment - okhttpJob Status: success
|
Test Environment - spring_bootJob Status: success
|
Test Environment - sonar-javaJob Status: success
|
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
daniel.mohedano@datadoghq.com unqueued this merge request |
|
/merge -c |
|
View all feedbacks in Devflow UI.
|
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
What Does This Do
fireTestSuiteStartedandfireTestSuiteFinishedmethods to unwrap the notifiers and propagate the firing to our tracing listener.Motivation
Bazel's default JUnit4 configuration for running test suites introduces changes that mess with our instrumentation:
BazelTestRunner.main(), which builds aJUnit4Runner(does not inheritorg.junit.runner.Runner) and callsrun().JUnit4Runner.run()instantiatesJUnitCore, registers its run listeners and callscore.run(cancellableRequest).JUnitCorecreates a freshRunNotifier(from now on A) and registers the listeners on it.CancellableRunner(extendsorg.junit.runner.Runner). Itsrun(A)doescurrentNotifier = new ThreadSafeRunNotifier(A); delegate.run(currentNotifier);.ThreadSafeRunNotifier extends RunNotifierWrapper extends RunNotifier, socurrentNotifier(from now on B) has its own private inheritedlistenersfield.runner.run(B)executes.B.addListener(tracingListener), butBs implementation overrides the method to calldelegate.addListener(tracingListener);so our listener lands onA.listeners.B.fireTestSuiteStarted(...).RunNotifier.fireTestSuiteStarted(...)invoked withthis = B. This iterates overB.listeners, which is empty.delegate.fireTest...(...)by overriding the methodsAll this caused test suite events to be dropped.
Additional Notes
test-environment-trigger: skip
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]
Note: Once your PR is ready to merge, add it to the merge queue by commenting
/merge./merge -ccancels the queue request./merge -f --reason "reason"skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.