You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by GitBox <gi...@apache.org> on 2021/09/06 11:56:29 UTC
[GitHub] [incubator-kyuubi] yanghua commented on a change in pull request #1038: [KYUUBI #1031] Implement api: /sessions/count
yanghua commented on a change in pull request #1038:
URL: https://github.com/apache/incubator-kyuubi/pull/1038#discussion_r702843900
##########
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:
Here for testing, we can use the default port?
--
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: commits-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org