[KYUUBI #1654][Bug] Flaky OperationsResourceSuite

### _Why are the changes needed?_
closes #1654

### _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 #1655 from simon824/flaky.

Closes #1654

92548e46 [simon] style
3a748969 [simon] state
3c507da3 [simon] state
4436bb89 [simon] rm
e12d483c [simon] flakyut

Authored-by: simon <zhangshiming@cvte.com>
Signed-off-by: Kent Yao <yao@apache.org>
This commit is contained in:
simon 2021-12-31 19:28:57 +08:00 committed by Kent Yao
parent 4e3c718108
commit 4655cd8515
No known key found for this signature in database
GPG Key ID: F7051850A0AF904D

View File

@ -26,7 +26,7 @@ import org.scalatest.time.SpanSugar.convertIntToGrainOfTime
import org.apache.kyuubi.{KyuubiFunSuite, RestFrontendTestHelper}
import org.apache.kyuubi.events.KyuubiOperationEvent
import org.apache.kyuubi.operation.{OperationState, OperationType}
import org.apache.kyuubi.operation.{ExecuteStatement, OperationState, OperationType}
import org.apache.kyuubi.operation.OperationState.{FINISHED, OperationState}
import org.apache.kyuubi.operation.OperationType.OperationType
@ -48,7 +48,20 @@ class OperationsResourceSuite extends KyuubiFunSuite with RestFrontendTestHelper
}
test("apply an action for an operation") {
val opHandleStr = getOpHandleStr(OperationType.EXECUTE_STATEMENT)
val sessionHandle = fe.be.openSession(
HIVE_CLI_SERVICE_PROTOCOL_V2,
"admin",
"123456",
"localhost",
Map("testConfig" -> "testValue"))
val sessionManager = fe.be.sessionManager
val session = sessionManager.getSession(sessionHandle)
val op = new ExecuteStatement(session, "show tables", true, 3000)
op.setState(OperationState.RUNNING)
sessionManager.operationManager.addOperation(op)
val opHandleStr = s"${op.getHandle.identifier.publicId}|" +
s"${op.getHandle.identifier.secretId}|${op.getHandle.protocol.getValue}|" +
s"${op.getHandle.typ.toString}"
var response = webTarget.path(s"api/v1/operations/$opHandleStr")
.request(MediaType.APPLICATION_JSON_TYPE)