@@ -61,7 +61,7 @@ class EventLoggingListenerSuite extends FunSuite with LocalSparkContext with Bef
6161 test(" Verify log file exist" ) {
6262 // Verify logging directory exists
6363 val conf = getLoggingConf(testDirPath)
64- val eventLogger = new EventLoggingListener (" test" , testDirPath.toUri().toString() , conf)
64+ val eventLogger = new EventLoggingListener (" test" , testDirPath.toUri(), conf)
6565 eventLogger.start()
6666
6767 val logPath = new Path (eventLogger.logPath + EventLoggingListener .IN_PROGRESS )
@@ -95,7 +95,7 @@ class EventLoggingListenerSuite extends FunSuite with LocalSparkContext with Bef
9595 }
9696
9797 test(" Log overwriting" ) {
98- val logUri = EventLoggingListener .getLogPath(testDir.getAbsolutePath , " test" )
98+ val logUri = EventLoggingListener .getLogPath(testDir.toURI , " test" )
9999 val logPath = new URI (logUri).getPath
100100 // Create file before writing the event log
101101 new FileOutputStream (new File (logPath)).close()
@@ -107,16 +107,19 @@ class EventLoggingListenerSuite extends FunSuite with LocalSparkContext with Bef
107107
108108 test(" Event log name" ) {
109109 // without compression
110- assert(s " file:/base-dir/app1 " === EventLoggingListener .getLogPath(" /base-dir" , " app1" ))
110+ assert(s " file:/base-dir/app1 " === EventLoggingListener .getLogPath(
111+ Utils .resolveURI(" /base-dir" ), " app1" ))
111112 // with compression
112113 assert(s " file:/base-dir/app1.lzf " ===
113- EventLoggingListener .getLogPath(" /base-dir" , " app1" , Some (" lzf" )))
114+ EventLoggingListener .getLogPath(Utils .resolveURI( " /base-dir" ) , " app1" , Some (" lzf" )))
114115 // illegal characters in app ID
115116 assert(s " file:/base-dir/a-fine-mind_dollar_bills__1 " ===
116- EventLoggingListener .getLogPath(" /base-dir" , " a fine:mind$dollar{bills}.1" ))
117+ EventLoggingListener .getLogPath(Utils .resolveURI(" /base-dir" ),
118+ " a fine:mind$dollar{bills}.1" ))
117119 // illegal characters in app ID with compression
118120 assert(s " file:/base-dir/a-fine-mind_dollar_bills__1.lz4 " ===
119- EventLoggingListener .getLogPath(" /base-dir" , " a fine:mind$dollar{bills}.1" , Some (" lz4" )))
121+ EventLoggingListener .getLogPath(Utils .resolveURI(" /base-dir" ),
122+ " a fine:mind$dollar{bills}.1" , Some (" lz4" )))
120123 }
121124
122125 /* ----------------- *
@@ -137,7 +140,7 @@ class EventLoggingListenerSuite extends FunSuite with LocalSparkContext with Bef
137140 val conf = getLoggingConf(testDirPath, compressionCodec)
138141 extraConf.foreach { case (k, v) => conf.set(k, v) }
139142 val logName = compressionCodec.map(" test-" + _).getOrElse(" test" )
140- val eventLogger = new EventLoggingListener (logName, testDirPath.toUri().toString() , conf)
143+ val eventLogger = new EventLoggingListener (logName, testDirPath.toUri(), conf)
141144 val listenerBus = new LiveListenerBus
142145 val applicationStart = SparkListenerApplicationStart (" Greatest App (N)ever" , None ,
143146 125L , " Mickey" )
@@ -173,12 +176,15 @@ class EventLoggingListenerSuite extends FunSuite with LocalSparkContext with Bef
173176 * This runs a simple Spark job and asserts that the expected events are logged when expected.
174177 */
175178 private def testApplicationEventLogging (compressionCodec : Option [String ] = None ) {
179+ // Set defaultFS to something that would cause an exception, to make sure we don't run
180+ // into SPARK-6688.
176181 val conf = getLoggingConf(testDirPath, compressionCodec)
182+ .set(" spark.hadoop.fs.defaultFS" , " unsupported://example.com" )
177183 val sc = new SparkContext (" local-cluster[2,2,512]" , " test" , conf)
178184 assert(sc.eventLogger.isDefined)
179185 val eventLogger = sc.eventLogger.get
180186 val eventLogPath = eventLogger.logPath
181- val expectedLogDir = testDir.toURI().toString()
187+ val expectedLogDir = testDir.toURI()
182188 assert(eventLogPath === EventLoggingListener .getLogPath(
183189 expectedLogDir, sc.applicationId, compressionCodec.map(CompressionCodec .getShortName)))
184190
0 commit comments