Skip to content

Commit 53dc838

Browse files
author
Marcelo Vanzin
committed
Fix unit test.
1 parent 1f303e7 commit 53dc838

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/src/test/scala/org/apache/spark/status/AppStatusListenerSuite.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,15 +894,19 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
894894
val dropped = stages.drop(1).head
895895

896896
// Cache some quantiles by calling AppStatusStore.taskSummary(). For quantiles to be
897-
// calculcated, we need at least one finished task.
897+
// calculcated, we need at least one finished task. The code in AppStatusStore uses
898+
// `executorRunTime` to detect valid tasks, so that metric needs to be updated in the
899+
// task end event.
898900
time += 1
899901
val task = createTasks(1, Array("1")).head
900902
listener.onTaskStart(SparkListenerTaskStart(dropped.stageId, dropped.attemptId, task))
901903

902904
time += 1
903905
task.markFinished(TaskState.FINISHED, time)
906+
val metrics = TaskMetrics.empty
907+
metrics.setExecutorRunTime(42L)
904908
listener.onTaskEnd(SparkListenerTaskEnd(dropped.stageId, dropped.attemptId,
905-
"taskType", Success, task, null))
909+
"taskType", Success, task, metrics))
906910

907911
new AppStatusStore(store)
908912
.taskSummary(dropped.stageId, dropped.attemptId, Array(0.25d, 0.50d, 0.75d))

0 commit comments

Comments
 (0)