Github user jiangxb1987 commented on a diff in the pull request:
https://github.com/apache/spark/pull/18971#discussion_r135624751
--- Diff:
core/src/test/scala/org/apache/spark/scheduler/ReplayListenerSuite.scala ---
@@ -112,17 +112,19 @@ class ReplayListenerSuite extends SparkFunSuite with
BeforeAndAfter with LocalSp
// Verify the replay returns the events given the input maybe
truncated.
val logData = EventLoggingListener.openEventLog(logFilePath,
fileSystem)
- val failingStream = new EarlyEOFInputStream(logData, buffered.size -
10)
- replayer.replay(failingStream, logFilePath.toString, true)
+ Utils.tryWithResource(new EarlyEOFInputStream(logData, buffered.size -
10)) { failingStream =>
+ replayer.replay(failingStream, logFilePath.toString, true)
- assert(eventMonster.loggedEvents.size === 1)
- assert(failingStream.didFail)
+ assert(eventMonster.loggedEvents.size === 1)
+ assert(failingStream.didFail)
+ }
// Verify the replay throws the EOF exception since the input may not
be truncated.
val logData2 = EventLoggingListener.openEventLog(logFilePath,
fileSystem)
- val failingStream2 = new EarlyEOFInputStream(logData2, buffered.size -
10)
- intercept[EOFException] {
- replayer.replay(failingStream2, logFilePath.toString, false)
+ Utils.tryWithResource(new EarlyEOFInputStream(logData2, buffered.size
- 10)) { failingStream2 =>
--- End diff --
nit: I think we can still use `failingStream` here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]