Skip to content

Commit 3f4500f

Browse files
author
Marcelo Vanzin
committed
Unit test for SPARK-3697.
1 parent 45c7a1f commit 3f4500f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,30 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
138138
}
139139
}
140140

141+
test("SPARK-3697: ignore directories that cannot be read.") {
142+
val logFile1 = new File(testDir, "new1")
143+
writeFile(logFile1, true, None,
144+
SparkListenerApplicationStart("app1-1", None, 1L, "test"),
145+
SparkListenerApplicationEnd(2L)
146+
)
147+
val logFile2 = new File(testDir, "new2")
148+
writeFile(logFile2, true, None,
149+
SparkListenerApplicationStart("app1-2", None, 1L, "test"),
150+
SparkListenerApplicationEnd(2L)
151+
)
152+
logFile2.setReadable(false, false)
153+
154+
val conf = new SparkConf()
155+
.set("spark.history.fs.logDirectory", testDir.getAbsolutePath())
156+
.set("spark.history.fs.updateInterval", "0")
157+
val provider = new FsHistoryProvider(conf)
158+
provider.checkForLogs()
159+
160+
val list = provider.getListing().toSeq
161+
list should not be (null)
162+
list.size should be (1)
163+
}
164+
141165
private def writeFile(file: File, isNewFormat: Boolean, codec: Option[CompressionCodec],
142166
events: SparkListenerEvent*) = {
143167
val out =

0 commit comments

Comments
 (0)