You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ya...@apache.org on 2021/12/31 11:29:09 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #1654][Bug] Flaky OperationsResourceSuite

This is an automated email from the ASF dual-hosted git repository.

yao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new 4655cd8  [KYUUBI #1654][Bug] Flaky OperationsResourceSuite
4655cd8 is described below

commit 4655cd851596038bfbb5dc53f60e7612b702ee5e
Author: simon <zh...@cvte.com>
AuthorDate: Fri Dec 31 19:28:57 2021 +0800

    [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 <zh...@cvte.com>
    Signed-off-by: Kent Yao <ya...@apache.org>
---
 .../kyuubi/server/api/v1/OperationsResourceSuite.scala  | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/OperationsResourceSuite.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/OperationsResourceSuite.scala
index b698608..6d8808e 100644
--- a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/OperationsResourceSuite.scala
+++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/OperationsResourceSuite.scala
@@ -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)