From 77678fe01372ec272005900ae701ca553d0ee01e Mon Sep 17 00:00:00 2001 From: Kousuke Saruta Date: Tue, 20 Jan 2015 23:31:45 -0800 Subject: [PATCH] Fixed unstable test case in FsHistoryProviderSuite --- .../deploy/history/FsHistoryProviderSuite.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala b/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala index 8379883e065e7..15291e92ba1fb 100644 --- a/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala +++ b/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala @@ -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 { @@ -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") @@ -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") @@ -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 @@ -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 =>