Skip to content

Commit b248787

Browse files
committed
Add tests to verify the new tables
1 parent d18ab7d commit b248787

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

streaming/src/main/scala/org/apache/spark/streaming/ui/AllBatchesTable.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import scala.xml.Node
2222
import org.apache.spark.streaming.scheduler.BatchInfo
2323
import org.apache.spark.ui.UIUtils
2424

25-
private[ui] class BatchTableBase {
25+
private[ui] class BatchTableBase(tableId: String) {
2626

2727
protected def columns: Seq[Node] = {
2828
<th>Batch Time</th>
@@ -53,7 +53,7 @@ private[ui] class BatchTableBase {
5353
}
5454

5555
private def batchTable: Seq[Node] = {
56-
<table class="table table-bordered table-striped table-condensed sortable">
56+
<table id={tableId} class="table table-bordered table-striped table-condensed sortable">
5757
<thead>
5858
{columns}
5959
</thead>
@@ -74,7 +74,7 @@ private[ui] class BatchTableBase {
7474
}
7575

7676
private[ui] class ActiveBatchTable(runningBatches: Seq[BatchInfo], waitingBatches: Seq[BatchInfo])
77-
extends BatchTableBase {
77+
extends BatchTableBase("active-batches-table") {
7878

7979
override protected def columns: Seq[Node] = super.columns ++ <th>Status</th>
8080

@@ -94,7 +94,8 @@ private[ui] class ActiveBatchTable(runningBatches: Seq[BatchInfo], waitingBatche
9494
}
9595
}
9696

97-
private[ui] class CompletedBatchTable(batches: Seq[BatchInfo]) extends BatchTableBase {
97+
private[ui] class CompletedBatchTable(batches: Seq[BatchInfo])
98+
extends BatchTableBase("completed-batches-table") {
9899

99100
override protected def columns: Seq[Node] = super.columns ++ <th>Total Delay</th>
100101

streaming/src/test/scala/org/apache/spark/streaming/UISeleniumSuite.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ class UISeleniumSuite
7575
val statisticText = findAll(cssSelector("li strong")).map(_.text).toSeq
7676
statisticText should contain("Network receivers:")
7777
statisticText should contain("Batch interval:")
78+
79+
val h4Text = findAll(cssSelector("h4")).map(_.text).toSeq
80+
h4Text should contain("Active Batches (0)")
81+
h4Text should contain("Completed Batches (0)")
82+
83+
findAll(cssSelector("""#active-batches-table th""")).map(_.text).toSeq should be {
84+
List("Batch Time", "Input Size", "Scheduling Delay", "Processing Time", "Status")
85+
}
86+
findAll(cssSelector("""#completed-batches-table th""")).map(_.text).toSeq should be {
87+
List("Batch Time", "Input Size", "Scheduling Delay", "Processing Time", "Total Delay")
88+
}
7889
}
7990

8091
ssc.stop(false)

0 commit comments

Comments
 (0)