@@ -243,13 +243,12 @@ class FsHistoryProviderSuite extends SparkFunSuite with BeforeAndAfter with Matc
243243 appListAfterRename.size should be (1 )
244244 }
245245
246- test(" apps with multiple attempts" ) {
246+ test(" apps with multiple attempts with order " ) {
247247 val provider = new FsHistoryProvider (createTestConf())
248248
249- val attempt1 = newLogFile(" app1" , Some (" attempt1" ), inProgress = false )
249+ val attempt1 = newLogFile(" app1" , Some (" attempt1" ), inProgress = true )
250250 writeFile(attempt1, true , None ,
251- SparkListenerApplicationStart (" app1" , Some (" app1" ), 1L , " test" , Some (" attempt1" )),
252- SparkListenerApplicationEnd (2L )
251+ SparkListenerApplicationStart (" app1" , Some (" app1" ), 1L , " test" , Some (" attempt1" ))
253252 )
254253
255254 updateAndCheck(provider) { list =>
@@ -259,7 +258,7 @@ class FsHistoryProviderSuite extends SparkFunSuite with BeforeAndAfter with Matc
259258
260259 val attempt2 = newLogFile(" app1" , Some (" attempt2" ), inProgress = true )
261260 writeFile(attempt2, true , None ,
262- SparkListenerApplicationStart (" app1" , Some (" app1" ), 3L , " test" , Some (" attempt2" ))
261+ SparkListenerApplicationStart (" app1" , Some (" app1" ), 2L , " test" , Some (" attempt2" ))
263262 )
264263
265264 updateAndCheck(provider) { list =>
@@ -268,30 +267,29 @@ class FsHistoryProviderSuite extends SparkFunSuite with BeforeAndAfter with Matc
268267 list.head.attempts.head.attemptId should be (Some (" attempt2" ))
269268 }
270269
271- val completedAttempt2 = newLogFile(" app1" , Some (" attempt2" ), inProgress = false )
272- attempt2.delete()
273- writeFile(attempt2, true , None ,
274- SparkListenerApplicationStart (" app1" , Some (" app1" ), 3L , " test" , Some (" attempt2" )),
270+ val attempt3 = newLogFile(" app1" , Some (" attempt3" ), inProgress = false )
271+ writeFile(attempt3, true , None ,
272+ SparkListenerApplicationStart (" app1" , Some (" app1" ), 3L , " test" , Some (" attempt3" )),
275273 SparkListenerApplicationEnd (4L )
276274 )
277275
278276 updateAndCheck(provider) { list =>
279277 list should not be (null )
280278 list.size should be (1 )
281- list.head.attempts.size should be (2 )
282- list.head.attempts.head.attemptId should be (Some (" attempt2 " ))
279+ list.head.attempts.size should be (3 )
280+ list.head.attempts.head.attemptId should be (Some (" attempt3 " ))
283281 }
284282
285283 val app2Attempt1 = newLogFile(" app2" , Some (" attempt1" ), inProgress = false )
286- writeFile(attempt2 , true , None ,
284+ writeFile(attempt1 , true , None ,
287285 SparkListenerApplicationStart (" app2" , Some (" app2" ), 5L , " test" , Some (" attempt1" )),
288286 SparkListenerApplicationEnd (6L )
289287 )
290288
291289 updateAndCheck(provider) { list =>
292290 list.size should be (2 )
293291 list.head.attempts.size should be (1 )
294- list.last.attempts.size should be (2 )
292+ list.last.attempts.size should be (3 )
295293 list.head.attempts.head.attemptId should be (Some (" attempt1" ))
296294
297295 list.foreach { case app =>
0 commit comments