Skip to content

Commit 4655cd8

Browse files
simon824yaooqinn
authored andcommitted
[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 92548e4 [simon] style 3a74896 [simon] state 3c507da [simon] state 4436bb8 [simon] rm e12d483 [simon] flakyut Authored-by: simon <zhangshiming@cvte.com> Signed-off-by: Kent Yao <yao@apache.org>
1 parent 4e3c718 commit 4655cd8

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/OperationsResourceSuite.scala

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import org.scalatest.time.SpanSugar.convertIntToGrainOfTime
2626

2727
import org.apache.kyuubi.{KyuubiFunSuite, RestFrontendTestHelper}
2828
import org.apache.kyuubi.events.KyuubiOperationEvent
29-
import org.apache.kyuubi.operation.{OperationState, OperationType}
29+
import org.apache.kyuubi.operation.{ExecuteStatement, OperationState, OperationType}
3030
import org.apache.kyuubi.operation.OperationState.{FINISHED, OperationState}
3131
import org.apache.kyuubi.operation.OperationType.OperationType
3232

@@ -48,7 +48,20 @@ class OperationsResourceSuite extends KyuubiFunSuite with RestFrontendTestHelper
4848
}
4949

5050
test("apply an action for an operation") {
51-
val opHandleStr = getOpHandleStr(OperationType.EXECUTE_STATEMENT)
51+
val sessionHandle = fe.be.openSession(
52+
HIVE_CLI_SERVICE_PROTOCOL_V2,
53+
"admin",
54+
"123456",
55+
"localhost",
56+
Map("testConfig" -> "testValue"))
57+
val sessionManager = fe.be.sessionManager
58+
val session = sessionManager.getSession(sessionHandle)
59+
val op = new ExecuteStatement(session, "show tables", true, 3000)
60+
op.setState(OperationState.RUNNING)
61+
sessionManager.operationManager.addOperation(op)
62+
val opHandleStr = s"${op.getHandle.identifier.publicId}|" +
63+
s"${op.getHandle.identifier.secretId}|${op.getHandle.protocol.getValue}|" +
64+
s"${op.getHandle.typ.toString}"
5265

5366
var response = webTarget.path(s"api/v1/operations/$opHandleStr")
5467
.request(MediaType.APPLICATION_JSON_TYPE)

0 commit comments

Comments
 (0)