dongjoon-hyun commented on code in PR #54280:
URL: https://github.com/apache/spark/pull/54280#discussion_r2797263654
##########
core/src/test/scala/org/apache/spark/deploy/history/EventLogFileWritersSuite.scala:
##########
@@ -160,8 +160,148 @@ abstract class EventLogFileWritersSuite extends
SparkFunSuite with LocalSparkCon
expectedLines: Seq[String] = Seq.empty): Unit
}
+/**
+ * A test OutputStream that simulates IO errors.
+ */
+class ErrorThrowingOutputStream extends OutputStream {
+ var throwOnWrite: Boolean = false
+ var throwOnFlush: Boolean = false
+ var throwOnClose: Boolean = false
+
+ override def write(b: Int): Unit = {
+ if (throwOnWrite) {
+ throw new IOException("Simulated write error")
+ }
+ }
+
+ override def write(b: Array[Byte], off: Int, len: Int): Unit = {
+ if (throwOnWrite) {
+ throw new IOException("Simulated write error")
+ }
+ }
+
+ override def flush(): Unit = {
+ if (throwOnFlush) {
+ throw new IOException("Simulated flush error")
+ }
+ }
+
+ override def close(): Unit = {
+ if (throwOnClose) {
+ throw new IOException("Simulated close error")
Review Comment:
The test case matches Spark's code's exception message like the following.
Instead of this test suite string.
```
assert(warningMessages.exists(_.contains("Spark detects errors while
flushing")),
```
```
assert(warningMessages.exists(_.contains("Spark detects errors while
closing")),
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]