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/08/19 02:46:34 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #958] [TEST] Ensure two connections in user mode share the same engine

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 636d60a  [KYUUBI #958] [TEST] Ensure two connections in user mode share the same engine
636d60a is described below

commit 636d60aa711984cef838e2e765d2d76b09a27314
Author: Kent Yao <ya...@apache.org>
AuthorDate: Thu Aug 19 10:46:24 2021 +0800

    [KYUUBI #958] [TEST] Ensure two connections in user mode share the same engine
    
    <!--
    Thanks for sending a pull request!
    
    Here are some tips for you:
      1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
      2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
      3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
    -->
    
    ### _Why are the changes needed?_
    <!--
    Please clarify why the changes are needed. For instance,
      1. If you add a feature, you can talk about the use case of it.
      2. If you fix a bug, you can clarify why it is a bug.
    -->
    
    Ensure changes like #935 do not break the rule for the semantics of engine sharing
    
    If and only if we want engines to be pooling,  this test can be changed
    
    ### _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/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #958 from yaooqinn/same.
    
    Closes #958
    
    e172cebf [Kent Yao] Ensure two connections in user mode share the same engine
    
    Authored-by: Kent Yao <ya...@apache.org>
    Signed-off-by: Kent Yao <ya...@apache.org>
---
 .../operation/KyuubiOperationPerUserSuite.scala    | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/KyuubiOperationPerUserSuite.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/KyuubiOperationPerUserSuite.scala
index d2b2707..32aa966 100644
--- a/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/KyuubiOperationPerUserSuite.scala
+++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/KyuubiOperationPerUserSuite.scala
@@ -17,6 +17,8 @@
 
 package org.apache.kyuubi.operation
 
+import org.scalatest.time.SpanSugar._
+
 import org.apache.kyuubi.WithKyuubiServer
 import org.apache.kyuubi.config.KyuubiConf
 
@@ -27,4 +29,30 @@ class KyuubiOperationPerUserSuite extends WithKyuubiServer with JDBCTests {
   override protected val conf: KyuubiConf = {
     KyuubiConf().set(KyuubiConf.ENGINE_SHARE_LEVEL, "user")
   }
+
+  test("ensure two connections in user mode share the same engine") {
+    var r1: String = null
+    var r2: String = null
+    new Thread {
+      override def run(): Unit = withJdbcStatement() { statement =>
+        val res = statement.executeQuery("set spark.app.name")
+        assert(res.next())
+        r1 = res.getString("value")
+      }
+    }.start()
+
+    new Thread {
+      override def run(): Unit = withJdbcStatement() { statement =>
+        val res = statement.executeQuery("set spark.app.name")
+        assert(res.next())
+        r2 = res.getString("value")
+      }
+    }.start()
+
+    eventually(timeout(120.seconds), interval(100.milliseconds)) {
+      assert(r1 != null && r2 != null)
+    }
+
+    assert(r1 === r2)
+  }
 }