Skip to content

Commit

Permalink
Fixed unstable test case in FsHistoryProviderSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
sarutak committed Jan 21, 2015
1 parent 9a151ce commit 77678fe
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
testDir = Utils.createTempDir()
provider = new FsHistoryProvider(new SparkConf()
.set("spark.history.fs.logDirectory", testDir.getAbsolutePath())
.set("spark.history.fs.updateInterval", "0"))
.set("spark.testing", "true"))
}

after {
Expand All @@ -62,12 +62,14 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
SparkListenerApplicationStart("app1-1", None, 1L, "test"),
SparkListenerApplicationEnd(2L)
)
provider.checkForLogs()

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

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

// Write an unfinished app, old-style.
val oldLog2 = new File(testDir, "old2")
Expand All @@ -86,9 +89,6 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
writeFile(new File(oldLog2, provider.LOG_PREFIX + "1"), false, None,
SparkListenerApplicationStart("app4", None, 2L, "test")
)

// Force a reload of data from the log directory, and check that both logs are loaded.
// Take the opportunity to check that the offset checks work as expected.
provider.checkForLogs()

val list = provider.getListing().toSeq
Expand All @@ -100,10 +100,10 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
oldLog.lastModified(), "test", true))
list(1) should be (ApplicationHistoryInfo(logFile1.getName(), "app1-1", 1L, 2L,
logFile1.lastModified(), "test", true))
list(2) should be (ApplicationHistoryInfo(oldLog2.getName(), "app4", 2L, -1L,
oldLog2.lastModified(), "test", false))
list(3) should be (ApplicationHistoryInfo(logFile2.getName(), "app2-2", 1L, -1L,
list(2) should be (ApplicationHistoryInfo(logFile2.getName(), "app2-2", 1L, -1L,
logFile2.lastModified(), "test", false))
list(3) should be (ApplicationHistoryInfo(oldLog2.getName(), "app4", 2L, -1L,
oldLog2.lastModified(), "test", false))

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

0 comments on commit 77678fe

Please sign in to comment.