ulysses-you commented on a change in pull request #1038:
URL: https://github.com/apache/incubator-kyuubi/pull/1038#discussion_r702847349
##########
File path:
kyuubi-server/src/test/scala/org/apache/kyuubi/server/RestFrontendServiceSuite.scala
##########
@@ -61,29 +64,62 @@ class RestFrontendServiceSuite extends KyuubiFunSuite{
}
test("kyuubi rest frontend service http basic") {
+ withKyuubiRestServer {
+ (_, _) =>
+ eventually(timeout(10.seconds), interval(50.milliseconds)) {
+ val html =
Source.fromURL("http://localhost:10099/api/v1/ping").mkString
+ assert(html.toLowerCase(Locale.ROOT).equals("pong"))
+ }
+ }
+ }
+
+ test("kyuubi rest frontend service for sessions resource") {
+ withKyuubiRestServer {
+ (_, _) =>
+ val expectedCount = new SessionOpenedCount()
+ expectedCount.setOpenSessionCount(1)
+ val expectedStr = new ObjectMapper().writeValueAsString(expectedCount)
+
+ eventually(timeout(10.seconds), interval(50.milliseconds)) {
+ val html =
Source.fromURL("http://localhost:10099/api/v1/sessions/count").mkString
+ assert(html.toLowerCase(Locale.ROOT).equalsIgnoreCase(expectedStr))
+ }
+ }
+ }
+
+ def withKyuubiRestServer(f: (RestNoopServer, RestFrontendService) => Unit):
Unit = {
val server = new RestNoopServer()
server.stop()
val conf = KyuubiConf()
conf.set(KyuubiConf.FRONTEND_REST_BIND_HOST, "localhost")
Review comment:
We can return host:port in closure so we don't need hard code them. And
seems the `server` seems not useful, `frontendService` is enough. what do you
think ?
--
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]