[KYUUBI #1313][BUG] Flaky SessionsResourceSuite
### _Why are the changes needed?_ #1313 ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.readthedocs.io/en/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #1315 from simon824/getinfo. Closes #1313 4f26c59a [simon] reduce sleep time ebb6afb5 [simon] fixut 6c366c0b [simon] init Authored-by: simon <zhangshiming@cvte.com> Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
parent
0724f444c5
commit
c6710ae963
@ -20,6 +20,8 @@ package org.apache.kyuubi.server.api.v1
|
||||
import javax.ws.rs.client.Entity
|
||||
import javax.ws.rs.core.{MediaType, Response}
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
||||
import org.apache.kyuubi.KyuubiFunSuite
|
||||
import org.apache.kyuubi.server.{RestFrontendService, RestFrontendServiceSuite}
|
||||
import org.apache.kyuubi.session.SessionHandle
|
||||
@ -86,7 +88,7 @@ class SessionsResourceSuite extends KyuubiFunSuite {
|
||||
|
||||
val sessionManager = restFrontendService.be.sessionManager
|
||||
val future = sessionManager.submitBackgroundOperation(() => {
|
||||
Thread.sleep(3000)
|
||||
Thread.sleep(1000)
|
||||
})
|
||||
|
||||
// verify the exec pool statistic
|
||||
@ -94,11 +96,12 @@ class SessionsResourceSuite extends KyuubiFunSuite {
|
||||
val execPoolStatistic1 = response.readEntity(classOf[ExecPoolStatistic])
|
||||
assert(execPoolStatistic1.execPoolSize == 1 && execPoolStatistic1.execPoolActiveCount == 1)
|
||||
|
||||
// if failed to cancel, need to wait the thread finish.
|
||||
if (!future.cancel(true)) Thread.sleep(3000)
|
||||
response = webTarget.path("api/v1/sessions/execpool/statistic").request().get()
|
||||
val execPoolStatistic2 = response.readEntity(classOf[ExecPoolStatistic])
|
||||
assert(execPoolStatistic2.execPoolSize == 1 && execPoolStatistic2.execPoolActiveCount == 0)
|
||||
future.cancel(true)
|
||||
eventually(timeout(3.seconds), interval(200.milliseconds)) {
|
||||
response = webTarget.path("api/v1/sessions/execpool/statistic").request().get()
|
||||
val statistic = response.readEntity(classOf[ExecPoolStatistic])
|
||||
assert(statistic.execPoolSize == 1 && statistic.execPoolActiveCount == 0)
|
||||
}
|
||||
|
||||
sessionManager.stop()
|
||||
response = webTarget.path("api/v1/sessions/execpool/statistic").request().get()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user