dongjoon-hyun commented on code in PR #60350:
URL: https://github.com/apache/spark/pull/60350#discussion_r4553198560
##########
core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala:
##########
@@ -775,6 +775,18 @@ abstract class HistoryServerSuite extends SparkFunSuite
with BeforeAndAfter with
assert(conn.getResponseCode === 302)
assert(conn.getHeaderField("Location") === "/")
}
+
+ test("/static/sql resources are served on startup without loading any app") {
Review Comment:
**[1] When the whole suite runs, this test does not start from a server
without loaded applications.**
`before` calls `init()` only while `server` is `null` (L121-125), so this
test reuses the server of the tests before it, and some of them load
application UIs into the cache. For example, the test at L680 opens the pages
of two applications. So the title holds only when this test runs alone with
`-z`.
The check itself is still right, since core has no SQL plugin. To make the
title true, the test could start with `stop()` and `init()` as the SPARK-33215
test does at L665-666, or assert that `server.cacheMetrics.loadCount.getCount`
is 0 before the requests.
##########
core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala:
##########
@@ -775,6 +775,18 @@ abstract class HistoryServerSuite extends SparkFunSuite
with BeforeAndAfter with
assert(conn.getResponseCode === 302)
assert(conn.getHeaderField("Location") === "/")
}
+
+ test("/static/sql resources are served on startup without loading any app") {
+ val port = server.boundPort
+ Seq(
Review Comment:
**[2] Only two of the five moved files are checked.**
The SQL tab's list page also loads `sql-table-utils.js` and
`allexecutionspage.js` (`AllExecutionsPage.scala:48-51`), and the execution
page loads `executionpage.js` (`ExecutionPage.scala:111-114`). If one of them
were lost or renamed in the move, both new tests would still pass, and the SQL
tab's tables would not render. Could this test and the one in `UISuite`
(`UISuite.scala:207-209`) iterate over all five files?
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SQLTab.scala:
##########
@@ -34,11 +34,5 @@ class SQLTab(val sqlStore: SQLAppStatusStore, sparkUI:
SparkUI)
attachPage(new ExecutionPage(this))
parent.attachTab(this)
Review Comment:
**[3] Nothing in sql/core checks that the SQL pages' `/static/sql` URLs are
still served.**
After this change, the SQL pages in sql/core load files that only core
provides, but the two new tests run in core, which has no SQL tab. So renaming
a file under `ui/static/sql/` in core, or changing a `<script src>` in
`ExecutionPage.scala`, would keep every test green and bring the 404s back. The
reported scenario itself, a SQL application loaded in the History Server and
then evicted, can also only be reproduced in sql/core.
`SQLHistoryServerStaticResourceSuite` in #58965 already does most of this.
It loads `local-1596020211915` from sql/core's test resources, attaches and
detaches its UI, and checks `/static/sql/spark-sql-viz.js` before and after.
Could you bring it over here? With this change, it could also assert that the
application's UI no longer registers a `/static/sql` handler.
##########
core/src/test/scala/org/apache/spark/ui/UISuite.scala:
##########
@@ -201,6 +201,20 @@ class UISuite extends SparkFunSuite {
}
}
+ test("/static/sql resources are served by the core static handler") {
+ withSpark(newSparkContext()) { sc =>
Review Comment:
**[5] Nit: this test checks the same handler as the new `HistoryServerSuite`
test.**
`SparkUI.initialize` and `HistoryServer.initialize` both call
`addStaticHandler(SparkUI.STATIC_RESOURCE_DIR)`, so both tests check that
`JettyUtils.createStaticHandler` serves the `sql/` subdirectory. If you want a
separate check for the driver UI, this is fine as is; otherwise one of the two
tests would be enough.
##########
core/src/test/scala/org/apache/spark/ui/UISuite.scala:
##########
@@ -201,6 +201,20 @@ class UISuite extends SparkFunSuite {
}
}
+ test("/static/sql resources are served by the core static handler") {
Review Comment:
**[4] Nit: the two new tests could start with the JIRA ID.**
Regression tests in both suites usually do, such as `SPARK-31697:
HistoryServer should set Content-Type` in `HistoryServerSuite`. Could this test
and the new one in `HistoryServerSuite` start with `SPARK-59613: `?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]