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

ulyssesyou 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 6d94fee  [KYUUBI #1958] Fix flaky test: statement redact for engine tab
6d94fee is described below

commit 6d94fee6e38493982e22111f44641cc9aa92eddd
Author: Wang Zhen <[email protected]>
AuthorDate: Tue Mar 1 17:27:10 2022 +0800

    [KYUUBI #1958] Fix flaky test: statement redact for engine tab
    
    <!--
    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.
    -->
    
    close #1958
    
    ### _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.apache.org/docs/latest/develop_tools/testing.html#running-tests)
 locally before make a pull request
    
    Closes #1984 from wForget/KYUUBI-1958.
    
    Closes #1958
    
    7702b23b [Wang Zhen] [KYUUBI-1958] Fix flaky test: statement redact for 
engine tab *** FAILED ***
    
    Authored-by: Wang Zhen <[email protected]>
    Signed-off-by: ulysses-you <[email protected]>
---
 .../scala/org/apache/spark/ui/EngineTabSuite.scala | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git 
a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/spark/ui/EngineTabSuite.scala
 
b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/spark/ui/EngineTabSuite.scala
index 3803bd0..cb3ef24 100644
--- 
a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/spark/ui/EngineTabSuite.scala
+++ 
b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/spark/ui/EngineTabSuite.scala
@@ -17,16 +17,11 @@
 
 package org.apache.spark.ui
 
-import scala.collection.JavaConverters._
-
 import org.apache.http.client.methods.HttpGet
 import org.apache.http.impl.client.HttpClients
 import org.apache.http.util.EntityUtils
-import org.apache.spark.SparkContext
-import org.apache.spark.kyuubi.SparkContextHelper
 
 import org.apache.kyuubi.engine.spark.WithSparkSQLEngine
-import org.apache.kyuubi.engine.spark.events.{SessionEvent, 
SparkOperationEvent}
 import org.apache.kyuubi.operation.HiveJDBCTestHelper
 
 class EngineTabSuite extends WithSparkSQLEngine with HiveJDBCTestHelper {
@@ -35,19 +30,14 @@ class EngineTabSuite extends WithSparkSQLEngine with 
HiveJDBCTestHelper {
     "spark.ui.port" -> "0",
     "spark.sql.redaction.string.regex" -> "(?i)url|access|secret|password")
 
-  override def beforeAll(): Unit = {
-    SparkContext.getActive.foreach(_.stop())
-    super.beforeAll()
+  override protected def beforeEach(): Unit = {
+    super.beforeEach()
+    startSparkEngine()
   }
 
-  override protected def beforeEach(): Unit = {
-    val kvstore = SparkContextHelper.getKvStore(spark.sparkContext)
-    kvstore.view(classOf[SessionEvent]).closeableIterator().asScala.foreach(j 
=> {
-      kvstore.delete(j.getClass, j.sessionId)
-    })
-    
kvstore.view(classOf[SparkOperationEvent]).closeableIterator().asScala.foreach(j
 => {
-      kvstore.delete(j.getClass, j.statementId)
-    })
+  override protected def afterEach(): Unit = {
+    super.afterEach()
+    stopSparkEngine()
   }
 
   test("basic stats for engine tab") {

Reply via email to