aboutsummaryrefslogtreecommitdiff
path: root/core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test')
-rw-r--r--core/src/test/resources/HistoryServerExpectations/application_list_json_expectation.json18
-rw-r--r--core/src/test/resources/HistoryServerExpectations/completed_app_list_json_expectation.json18
-rw-r--r--core/src/test/resources/HistoryServerExpectations/maxDate2_app_list_json_expectation.json4
-rw-r--r--core/src/test/resources/HistoryServerExpectations/maxDate_app_list_json_expectation.json6
-rw-r--r--core/src/test/resources/HistoryServerExpectations/minDate_app_list_json_expectation.json14
-rw-r--r--core/src/test/resources/HistoryServerExpectations/one_app_json_expectation.json4
-rw-r--r--core/src/test/resources/HistoryServerExpectations/one_app_multi_attempt_json_expectation.json6
-rw-r--r--core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala43
8 files changed, 81 insertions, 32 deletions
diff --git a/core/src/test/resources/HistoryServerExpectations/application_list_json_expectation.json b/core/src/test/resources/HistoryServerExpectations/application_list_json_expectation.json
index d575bf2f28..5bbb4ceb97 100644
--- a/core/src/test/resources/HistoryServerExpectations/application_list_json_expectation.json
+++ b/core/src/test/resources/HistoryServerExpectations/application_list_json_expectation.json
@@ -4,6 +4,8 @@
"attempts" : [ {
"startTime" : "2015-05-06T13:03:00.893GMT",
"endTime" : "2015-05-06T13:03:11.398GMT",
+ "lastUpdated" : "",
+ "duration" : 10505,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -14,12 +16,16 @@
"attemptId" : "2",
"startTime" : "2015-05-06T13:03:00.893GMT",
"endTime" : "2015-05-06T13:03:00.950GMT",
+ "lastUpdated" : "",
+ "duration" : 57,
"sparkUser" : "irashid",
"completed" : true
}, {
"attemptId" : "1",
"startTime" : "2015-05-06T13:03:00.880GMT",
"endTime" : "2015-05-06T13:03:00.890GMT",
+ "lastUpdated" : "",
+ "duration" : 10,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -30,12 +36,16 @@
"attemptId" : "2",
"startTime" : "2015-03-17T23:11:50.242GMT",
"endTime" : "2015-03-17T23:12:25.177GMT",
+ "lastUpdated" : "",
+ "duration" : 34935,
"sparkUser" : "irashid",
"completed" : true
}, {
"attemptId" : "1",
"startTime" : "2015-03-16T19:25:10.242GMT",
"endTime" : "2015-03-16T19:25:45.177GMT",
+ "lastUpdated" : "",
+ "duration" : 34935,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -45,6 +55,8 @@
"attempts" : [ {
"startTime" : "2015-02-28T00:02:38.277GMT",
"endTime" : "2015-02-28T00:02:46.912GMT",
+ "lastUpdated" : "",
+ "duration" : 8635,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -54,6 +66,8 @@
"attempts" : [ {
"startTime" : "2015-02-03T16:42:59.720GMT",
"endTime" : "2015-02-03T16:43:08.731GMT",
+ "lastUpdated" : "",
+ "duration" : 9011,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -63,7 +77,9 @@
"attempts" : [ {
"startTime" : "2015-02-03T16:42:38.277GMT",
"endTime" : "2015-02-03T16:42:46.912GMT",
+ "lastUpdated" : "",
+ "duration" : 8635,
"sparkUser" : "irashid",
"completed" : true
} ]
-} ] \ No newline at end of file
+} ]
diff --git a/core/src/test/resources/HistoryServerExpectations/completed_app_list_json_expectation.json b/core/src/test/resources/HistoryServerExpectations/completed_app_list_json_expectation.json
index d575bf2f28..5bbb4ceb97 100644
--- a/core/src/test/resources/HistoryServerExpectations/completed_app_list_json_expectation.json
+++ b/core/src/test/resources/HistoryServerExpectations/completed_app_list_json_expectation.json
@@ -4,6 +4,8 @@
"attempts" : [ {
"startTime" : "2015-05-06T13:03:00.893GMT",
"endTime" : "2015-05-06T13:03:11.398GMT",
+ "lastUpdated" : "",
+ "duration" : 10505,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -14,12 +16,16 @@
"attemptId" : "2",
"startTime" : "2015-05-06T13:03:00.893GMT",
"endTime" : "2015-05-06T13:03:00.950GMT",
+ "lastUpdated" : "",
+ "duration" : 57,
"sparkUser" : "irashid",
"completed" : true
}, {
"attemptId" : "1",
"startTime" : "2015-05-06T13:03:00.880GMT",
"endTime" : "2015-05-06T13:03:00.890GMT",
+ "lastUpdated" : "",
+ "duration" : 10,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -30,12 +36,16 @@
"attemptId" : "2",
"startTime" : "2015-03-17T23:11:50.242GMT",
"endTime" : "2015-03-17T23:12:25.177GMT",
+ "lastUpdated" : "",
+ "duration" : 34935,
"sparkUser" : "irashid",
"completed" : true
}, {
"attemptId" : "1",
"startTime" : "2015-03-16T19:25:10.242GMT",
"endTime" : "2015-03-16T19:25:45.177GMT",
+ "lastUpdated" : "",
+ "duration" : 34935,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -45,6 +55,8 @@
"attempts" : [ {
"startTime" : "2015-02-28T00:02:38.277GMT",
"endTime" : "2015-02-28T00:02:46.912GMT",
+ "lastUpdated" : "",
+ "duration" : 8635,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -54,6 +66,8 @@
"attempts" : [ {
"startTime" : "2015-02-03T16:42:59.720GMT",
"endTime" : "2015-02-03T16:43:08.731GMT",
+ "lastUpdated" : "",
+ "duration" : 9011,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -63,7 +77,9 @@
"attempts" : [ {
"startTime" : "2015-02-03T16:42:38.277GMT",
"endTime" : "2015-02-03T16:42:46.912GMT",
+ "lastUpdated" : "",
+ "duration" : 8635,
"sparkUser" : "irashid",
"completed" : true
} ]
-} ] \ No newline at end of file
+} ]
diff --git a/core/src/test/resources/HistoryServerExpectations/maxDate2_app_list_json_expectation.json b/core/src/test/resources/HistoryServerExpectations/maxDate2_app_list_json_expectation.json
index 483632a395..3f80a529a0 100644
--- a/core/src/test/resources/HistoryServerExpectations/maxDate2_app_list_json_expectation.json
+++ b/core/src/test/resources/HistoryServerExpectations/maxDate2_app_list_json_expectation.json
@@ -4,7 +4,9 @@
"attempts" : [ {
"startTime" : "2015-02-03T16:42:38.277GMT",
"endTime" : "2015-02-03T16:42:46.912GMT",
+ "lastUpdated" : "",
+ "duration" : 8635,
"sparkUser" : "irashid",
"completed" : true
} ]
-} ] \ No newline at end of file
+} ]
diff --git a/core/src/test/resources/HistoryServerExpectations/maxDate_app_list_json_expectation.json b/core/src/test/resources/HistoryServerExpectations/maxDate_app_list_json_expectation.json
index 4b85690fd9..508bdc17ef 100644
--- a/core/src/test/resources/HistoryServerExpectations/maxDate_app_list_json_expectation.json
+++ b/core/src/test/resources/HistoryServerExpectations/maxDate_app_list_json_expectation.json
@@ -4,6 +4,8 @@
"attempts" : [ {
"startTime" : "2015-02-03T16:42:59.720GMT",
"endTime" : "2015-02-03T16:43:08.731GMT",
+ "lastUpdated" : "",
+ "duration" : 9011,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -13,7 +15,9 @@
"attempts" : [ {
"startTime" : "2015-02-03T16:42:38.277GMT",
"endTime" : "2015-02-03T16:42:46.912GMT",
+ "lastUpdated" : "",
+ "duration" : 8635,
"sparkUser" : "irashid",
"completed" : true
} ]
-} ] \ No newline at end of file
+} ]
diff --git a/core/src/test/resources/HistoryServerExpectations/minDate_app_list_json_expectation.json b/core/src/test/resources/HistoryServerExpectations/minDate_app_list_json_expectation.json
index 15c2de8ef9..5dca7d73de 100644
--- a/core/src/test/resources/HistoryServerExpectations/minDate_app_list_json_expectation.json
+++ b/core/src/test/resources/HistoryServerExpectations/minDate_app_list_json_expectation.json
@@ -4,6 +4,8 @@
"attempts" : [ {
"startTime" : "2015-05-06T13:03:00.893GMT",
"endTime" : "2015-05-06T13:03:11.398GMT",
+ "lastUpdated" : "",
+ "duration" : 10505,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -14,12 +16,16 @@
"attemptId" : "2",
"startTime" : "2015-05-06T13:03:00.893GMT",
"endTime" : "2015-05-06T13:03:00.950GMT",
+ "lastUpdated" : "",
+ "duration" : 57,
"sparkUser" : "irashid",
"completed" : true
}, {
"attemptId" : "1",
"startTime" : "2015-05-06T13:03:00.880GMT",
"endTime" : "2015-05-06T13:03:00.890GMT",
+ "lastUpdated" : "",
+ "duration" : 10,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -30,12 +36,16 @@
"attemptId" : "2",
"startTime" : "2015-03-17T23:11:50.242GMT",
"endTime" : "2015-03-17T23:12:25.177GMT",
+ "lastUpdated" : "",
+ "duration" : 34935,
"sparkUser" : "irashid",
"completed" : true
}, {
"attemptId" : "1",
"startTime" : "2015-03-16T19:25:10.242GMT",
"endTime" : "2015-03-16T19:25:45.177GMT",
+ "lastUpdated" : "",
+ "duration" : 34935,
"sparkUser" : "irashid",
"completed" : true
} ]
@@ -46,8 +56,10 @@
{
"startTime": "2015-02-28T00:02:38.277GMT",
"endTime": "2015-02-28T00:02:46.912GMT",
+ "lastUpdated" : "",
+ "duration" : 8635,
"sparkUser": "irashid",
"completed": true
}
]
-} ] \ No newline at end of file
+} ]
diff --git a/core/src/test/resources/HistoryServerExpectations/one_app_json_expectation.json b/core/src/test/resources/HistoryServerExpectations/one_app_json_expectation.json
index 07489ad964..cca32c7910 100644
--- a/core/src/test/resources/HistoryServerExpectations/one_app_json_expectation.json
+++ b/core/src/test/resources/HistoryServerExpectations/one_app_json_expectation.json
@@ -4,7 +4,9 @@
"attempts" : [ {
"startTime" : "2015-02-03T16:42:59.720GMT",
"endTime" : "2015-02-03T16:43:08.731GMT",
+ "lastUpdated" : "",
+ "duration" : 9011,
"sparkUser" : "irashid",
"completed" : true
} ]
-} \ No newline at end of file
+}
diff --git a/core/src/test/resources/HistoryServerExpectations/one_app_multi_attempt_json_expectation.json b/core/src/test/resources/HistoryServerExpectations/one_app_multi_attempt_json_expectation.json
index 8f3d7160c7..1ea1779e83 100644
--- a/core/src/test/resources/HistoryServerExpectations/one_app_multi_attempt_json_expectation.json
+++ b/core/src/test/resources/HistoryServerExpectations/one_app_multi_attempt_json_expectation.json
@@ -5,13 +5,17 @@
"attemptId" : "2",
"startTime" : "2015-03-17T23:11:50.242GMT",
"endTime" : "2015-03-17T23:12:25.177GMT",
+ "lastUpdated" : "",
+ "duration" : 34935,
"sparkUser" : "irashid",
"completed" : true
}, {
"attemptId" : "1",
"startTime" : "2015-03-16T19:25:10.242GMT",
"endTime" : "2015-03-16T19:25:45.177GMT",
+ "lastUpdated" : "",
+ "duration" : 34935,
"sparkUser" : "irashid",
"completed" : true
} ]
-} \ No newline at end of file
+}
diff --git a/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala b/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala
index 18659fc0c1..be55b2e0fe 100644
--- a/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala
+++ b/core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala
@@ -139,7 +139,24 @@ class HistoryServerSuite extends SparkFunSuite with BeforeAndAfter with Matchers
code should be (HttpServletResponse.SC_OK)
jsonOpt should be ('defined)
errOpt should be (None)
- val json = jsonOpt.get
+ val jsonOrg = jsonOpt.get
+
+ // SPARK-10873 added the lastUpdated field for each application's attempt,
+ // the REST API returns the last modified time of EVENT LOG file for this field.
+ // It is not applicable to hard-code this dynamic field in a static expected file,
+ // so here we skip checking the lastUpdated field's value (setting it as "").
+ val json = if (jsonOrg.indexOf("lastUpdated") >= 0) {
+ val subStrings = jsonOrg.split(",")
+ for (i <- subStrings.indices) {
+ if (subStrings(i).indexOf("lastUpdated") >= 0) {
+ subStrings(i) = "\"lastUpdated\":\"\""
+ }
+ }
+ subStrings.mkString(",")
+ } else {
+ jsonOrg
+ }
+
val exp = IOUtils.toString(new FileInputStream(
new File(expRoot, HistoryServerSuite.sanitizePath(name) + "_expectation.json")))
// compare the ASTs so formatting differences don't cause failures
@@ -241,30 +258,6 @@ class HistoryServerSuite extends SparkFunSuite with BeforeAndAfter with Matchers
getContentAndCode("foobar")._1 should be (HttpServletResponse.SC_NOT_FOUND)
}
- test("generate history page with relative links") {
- val historyServer = mock[HistoryServer]
- val request = mock[HttpServletRequest]
- val ui = mock[SparkUI]
- val link = "/history/app1"
- val info = new ApplicationHistoryInfo("app1", "app1",
- List(ApplicationAttemptInfo(None, 0, 2, 1, "xxx", true)))
- when(historyServer.getApplicationList()).thenReturn(Seq(info))
- when(ui.basePath).thenReturn(link)
- when(historyServer.getProviderConfig()).thenReturn(Map[String, String]())
- val page = new HistoryPage(historyServer)
-
- // when
- val response = page.render(request)
-
- // then
- val links = response \\ "a"
- val justHrefs = for {
- l <- links
- attrs <- l.attribute("href")
- } yield (attrs.toString)
- justHrefs should contain (UIUtils.prependBaseUri(resource = link))
- }
-
test("relative links are prefixed with uiRoot (spark.ui.proxyBase)") {
val proxyBaseBeforeTest = System.getProperty("spark.ui.proxyBase")
val uiRoot = Option(System.getenv("APPLICATION_WEB_PROXY_BASE")).getOrElse("/testwebproxybase")