srowen commented on a change in pull request #23404: [SPARK-26501]Fix
unexpected overriden of exitFn in SparkSubmitSuite
URL: https://github.com/apache/spark/pull/23404#discussion_r244597129
##########
File path: core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala
##########
@@ -72,26 +72,32 @@ trait TestPrematureExit {
mainObject.printStream = printStream
@volatile var exitedCleanly = false
- mainObject.exitFn = (_) => exitedCleanly = true
-
- @volatile var exception: Exception = null
- val thread = new Thread {
- override def run() = try {
- mainObject.main(input)
- } catch {
- // Capture the exception to check whether the exception contains
searchString or not
- case e: Exception => exception = e
- }
+ def withFakeExit(body: => Unit): Unit = {
Review comment:
If this is the only occurrence, why a helper method? it seems more complex.
Also don't you want a try-finally to ensure the exitFn is restored?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]