You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ul...@apache.org on 2023/03/22 09:27:38 UTC

[kyuubi] branch branch-1.7 updated: [KYUUBI #4579] Fix the unstable situation of test cases for Trino-Fronted-Service

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

ulyssesyou pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.7 by this push:
     new 32e953e44 [KYUUBI #4579] Fix the unstable situation of test cases for Trino-Fronted-Service
32e953e44 is described below

commit 32e953e44683ef2e4c86d933ff88c4acb36a1398
Author: odone <od...@gmail.com>
AuthorDate: Wed Mar 22 17:27:11 2023 +0800

    [KYUUBI #4579] Fix the unstable situation of test cases for Trino-Fronted-Service
    
    ### _Why are the changes needed?_
    
    In the cancellation implementation of Trino frontend service, closing the operation will also close the session. There is no need to check the status of the operation here.
    
    ### _How was this patch tested?_
    - [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4579 from iodone/trino-fronted-test-fix.
    
    Closes #4579
    
    75e02dd1 [odone] Fix the unstable situation of test cases.
    
    Authored-by: odone <od...@gmail.com>
    Signed-off-by: ulyssesyou <ul...@apache.org>
    (cherry picked from commit f9701b03d72e65bb2655eb26a9c114295cf22606)
    Signed-off-by: ulyssesyou <ul...@apache.org>
---
 .../apache/kyuubi/server/trino/api/v1/StatementResourceSuite.scala | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/trino/api/v1/StatementResourceSuite.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/trino/api/v1/StatementResourceSuite.scala
index 5740f6d38..44602759c 100644
--- a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/trino/api/v1/StatementResourceSuite.scala
+++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/trino/api/v1/StatementResourceSuite.scala
@@ -26,7 +26,6 @@ import io.trino.client.{QueryError, QueryResults}
 import io.trino.client.ProtocolHeaders.TRINO_HEADERS
 
 import org.apache.kyuubi.{KyuubiFunSuite, KyuubiSQLException, TrinoRestFrontendTestHelper}
-import org.apache.kyuubi.operation.{OperationHandle, OperationState}
 import org.apache.kyuubi.server.trino.api.{Query, TrinoContext}
 import org.apache.kyuubi.server.trino.api.v1.dto.Ok
 import org.apache.kyuubi.session.SessionHandle
@@ -72,6 +71,7 @@ class StatementResourceSuite extends KyuubiFunSuite with TrinoRestFrontendTestHe
   test("query cancel") {
     val response = webTarget.path("v1/statement")
       .request().post(Entity.entity("select 1", MediaType.TEXT_PLAIN_TYPE))
+    assert(response.getStatus == 200)
     val qr = response.readEntity(classOf[QueryResults])
     val sessionManager = fe.be.sessionManager
     val sessionHandle =
@@ -84,16 +84,13 @@ class StatementResourceSuite extends KyuubiFunSuite with TrinoRestFrontendTestHe
           case Array(_, value) => SessionHandle.fromUUID(TrinoContext.urlDecode(value))
         }.get
     sessionManager.getSession(sessionHandle)
-    val operationHandle = OperationHandle(qr.getId)
-    val operation = sessionManager.operationManager.getOperation(operationHandle)
-    assert(response.getStatus == 200)
+
     val path = qr.getNextUri.getPath
     val nextResponse = webTarget.path(path).request().header(
       TRINO_HEADERS.requestSession(),
       s"${Query.KYUUBI_SESSION_ID}=${TrinoContext.urlEncode(sessionHandle.identifier.toString)}")
       .delete()
     assert(nextResponse.getStatus == 204)
-    assert(operation.getStatus.state == OperationState.CLOSED)
     val exception = intercept[KyuubiSQLException](sessionManager.getSession(sessionHandle))
     assert(exception.getMessage === s"Invalid $sessionHandle")
   }