viirya commented on code in PR #60591:
URL: https://github.com/apache/spark/pull/60591#discussion_r4595127058
##########
core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala:
##########
@@ -354,6 +354,25 @@ abstract class HistoryServerSuite extends SparkFunSuite
with BeforeAndAfter with
holdStatus._3 should be (Some("Hold status not available through the
history server."))
}
+ test("SPARK-61841: app UI action endpoints are not attached at global
paths") {
+ // Start with no app loaded, so that the codes below come from the history
server itself.
+ stop()
+ init()
+
+ // The paths the UI's forms post to. The trailing slash matters: without
it, a handler
+ // attached at the path only redirects to add the slash, which hides the
leak.
+ val actionPaths = Seq("/jobs/job/kill/", "/stages/stage/kill/",
"/jobs/hold/", "/jobs/resume/")
+ def postCodes(): Seq[Int] = actionPaths.map { path =>
+ TestUtils.httpResponseCode(new
URI(s"http://$localhost:$port$path").toURL, "POST")
+ }
+ val codesWithoutApp = postCodes()
+
+ // Loading an app attaches its UI handlers to the history server.
+ HistoryServerSuite.getUrl(
+ new
URI(s"http://$localhost:$port/history/local-1422981780767/jobs/").toURL)
+ assert(postCodes() === codesWithoutApp)
Review Comment:
This only shows the handlers are gone from the global paths, so it would
also pass if they were dropped entirely. Could we also assert they now answer
under the app's base path? For example:
```scala
assert(TestUtils.httpResponseCode(new URI(
s"http://$localhost:$port/history/local-1422981780767/jobs/job/kill/").toURL,
"POST") ===
HttpServletResponse.SC_FORBIDDEN)
```
--
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]