Skip to content

Commit 77678fe

Browse files
committed
Fixed unstable test case in FsHistoryProviderSuite
1 parent 9a151ce commit 77678fe

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
4343
testDir = Utils.createTempDir()
4444
provider = new FsHistoryProvider(new SparkConf()
4545
.set("spark.history.fs.logDirectory", testDir.getAbsolutePath())
46-
.set("spark.history.fs.updateInterval", "0"))
46+
.set("spark.testing", "true"))
4747
}
4848

4949
after {
@@ -62,12 +62,14 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
6262
SparkListenerApplicationStart("app1-1", None, 1L, "test"),
6363
SparkListenerApplicationEnd(2L)
6464
)
65+
provider.checkForLogs()
6566

6667
// Write an unfinished app, new-style.
6768
val logFile2 = new File(testDir, "new2" + EventLoggingListener.IN_PROGRESS)
6869
writeFile(logFile2, true, None,
6970
SparkListenerApplicationStart("app2-2", None, 1L, "test")
7071
)
72+
provider.checkForLogs()
7173

7274
// Write an old-style application log.
7375
val oldLog = new File(testDir, "old1")
@@ -78,6 +80,7 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
7880
SparkListenerApplicationEnd(3L)
7981
)
8082
createEmptyFile(new File(oldLog, provider.APPLICATION_COMPLETE))
83+
provider.checkForLogs()
8184

8285
// Write an unfinished app, old-style.
8386
val oldLog2 = new File(testDir, "old2")
@@ -86,9 +89,6 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
8689
writeFile(new File(oldLog2, provider.LOG_PREFIX + "1"), false, None,
8790
SparkListenerApplicationStart("app4", None, 2L, "test")
8891
)
89-
90-
// Force a reload of data from the log directory, and check that both logs are loaded.
91-
// Take the opportunity to check that the offset checks work as expected.
9292
provider.checkForLogs()
9393

9494
val list = provider.getListing().toSeq
@@ -100,10 +100,10 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
100100
oldLog.lastModified(), "test", true))
101101
list(1) should be (ApplicationHistoryInfo(logFile1.getName(), "app1-1", 1L, 2L,
102102
logFile1.lastModified(), "test", true))
103-
list(2) should be (ApplicationHistoryInfo(oldLog2.getName(), "app4", 2L, -1L,
104-
oldLog2.lastModified(), "test", false))
105-
list(3) should be (ApplicationHistoryInfo(logFile2.getName(), "app2-2", 1L, -1L,
103+
list(2) should be (ApplicationHistoryInfo(logFile2.getName(), "app2-2", 1L, -1L,
106104
logFile2.lastModified(), "test", false))
105+
list(3) should be (ApplicationHistoryInfo(oldLog2.getName(), "app4", 2L, -1L,
106+
oldLog2.lastModified(), "test", false))
107107

108108
// Make sure the UI can be rendered.
109109
list.foreach { case info =>

0 commit comments

Comments
 (0)