@@ -251,13 +251,12 @@ class FsHistoryProviderSuite extends SparkFunSuite with BeforeAndAfter with Matc
251251 appListAfterRename.size should be (1 )
252252 }
253253
254- test(" apps with multiple attempts" ) {
254+ test(" apps with multiple attempts with order " ) {
255255 val provider = new FsHistoryProvider (createTestConf())
256256
257- val attempt1 = newLogFile(" app1" , Some (" attempt1" ), inProgress = false )
257+ val attempt1 = newLogFile(" app1" , Some (" attempt1" ), inProgress = true )
258258 writeFile(attempt1, true , None ,
259- SparkListenerApplicationStart (" app1" , Some (" app1" ), 1L , " test" , Some (" attempt1" )),
260- SparkListenerApplicationEnd (2L )
259+ SparkListenerApplicationStart (" app1" , Some (" app1" ), 1L , " test" , Some (" attempt1" ))
261260 )
262261
263262 updateAndCheck(provider) { list =>
@@ -267,27 +266,26 @@ class FsHistoryProviderSuite extends SparkFunSuite with BeforeAndAfter with Matc
267266
268267 val attempt2 = newLogFile(" app1" , Some (" attempt2" ), inProgress = true )
269268 writeFile(attempt2, true , None ,
270- SparkListenerApplicationStart (" app1" , Some (" app1" ), 3L , " test" , Some (" attempt2" ))
269+ SparkListenerApplicationStart (" app1" , Some (" app1" ), 2L , " test" , Some (" attempt2" ))
271270 )
272271
273272 updateAndCheck(provider) { list =>
274273 list.size should be (1 )
275274 list.head.attempts.size should be (2 )
276- list.head.attempts.head.attemptId should be (Some (" attempt2 " ))
275+ list.head.attempts.head.attemptId should be (Some (" attempt1 " ))
277276 }
278277
279- val completedAttempt2 = newLogFile(" app1" , Some (" attempt2" ), inProgress = false )
280- attempt2.delete()
281- writeFile(attempt2, true , None ,
282- SparkListenerApplicationStart (" app1" , Some (" app1" ), 3L , " test" , Some (" attempt2" )),
278+ val attempt3 = newLogFile(" app1" , Some (" attempt3" ), inProgress = false )
279+ writeFile(attempt3, true , None ,
280+ SparkListenerApplicationStart (" app1" , Some (" app1" ), 3L , " test" , Some (" attempt3" )),
283281 SparkListenerApplicationEnd (4L )
284282 )
285283
286284 updateAndCheck(provider) { list =>
287285 list should not be (null )
288286 list.size should be (1 )
289- list.head.attempts.size should be (2 )
290- list.head.attempts.head.attemptId should be (Some (" attempt2 " ))
287+ list.head.attempts.size should be (3 )
288+ list.head.attempts.head.attemptId should be (Some (" attempt3 " ))
291289 }
292290
293291 val app2Attempt1 = newLogFile(" app2" , Some (" attempt1" ), inProgress = false )
@@ -299,7 +297,7 @@ class FsHistoryProviderSuite extends SparkFunSuite with BeforeAndAfter with Matc
299297 updateAndCheck(provider) { list =>
300298 list.size should be (2 )
301299 list.head.attempts.size should be (1 )
302- list.last.attempts.size should be (2 )
300+ list.last.attempts.size should be (3 )
303301 list.head.attempts.head.attemptId should be (Some (" attempt1" ))
304302
305303 list.foreach { case app =>
@@ -343,7 +341,7 @@ class FsHistoryProviderSuite extends SparkFunSuite with BeforeAndAfter with Matc
343341 updateAndCheck(provider) { list =>
344342 list.size should be (1 )
345343 list.head.attempts.size should be (1 )
346- list.head.attempts.head.attemptId should be (Some (" attempt2 " ))
344+ list.head.attempts.head.attemptId should be (Some (" attempt1 " ))
347345 }
348346 assert(! log1.exists())
349347
0 commit comments