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

chengpan 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 e78a8aa5f [KYUUBI #4919] Fix the flaky tests in the "open batch 
session" functionality within the "BatchesResourceSuite"
e78a8aa5f is described below

commit e78a8aa5f9181da78401f53599b9f696a602af91
Author: huangzhir <[email protected]>
AuthorDate: Mon Jun 5 10:34:39 2023 +0800

    [KYUUBI #4919] Fix the flaky tests in the "open batch session" 
functionality within the "BatchesResourceSuite"
    
    ### _Why are the changes needed?_
    
    Fix the flaky tests in the "open batch session" functionality within the 
"BatchesResourceSuite"
    to close https://github.com/apache/kyuubi/issues/4918
    
    ### _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
    
    - [X] [Run 
test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests)
 locally before make a pull request
    
    Closes #4919 from huangzhir/fix_flaky_tests_open_batch_sessio.
    
    Closes #4919
    
    e23087ba8 [huangzhir] To fix the flaky tests in the "open batch session" 
functionality within the "BatchesResourceSuite"
    
    Authored-by: huangzhir <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 02b1a7d44f03a1ea7c2eaef5be463d622b85c004)
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../kyuubi/server/api/v1/BatchesResourceSuite.scala  | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git 
a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/BatchesResourceSuite.scala
 
b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/BatchesResourceSuite.scala
index 055496ff3..dc59d75e3 100644
--- 
a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/BatchesResourceSuite.scala
+++ 
b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/api/v1/BatchesResourceSuite.scala
@@ -21,7 +21,7 @@ import java.net.InetAddress
 import java.nio.file.Paths
 import java.util.{Base64, UUID}
 import javax.ws.rs.client.Entity
-import javax.ws.rs.core.MediaType
+import javax.ws.rs.core.{MediaType, Response}
 
 import scala.collection.JavaConverters._
 import scala.collection.mutable.ArrayBuffer
@@ -114,14 +114,18 @@ class BatchesResourceSuite extends KyuubiFunSuite with 
RestFrontendTestHelper wi
     assert(404 == getBatchResponse.getStatus)
 
     // get batch log
-    var logResponse = 
webTarget.path(s"api/v1/batches/${batch.getId()}/localLog")
-      .queryParam("from", "0")
-      .queryParam("size", "1")
-      .request(MediaType.APPLICATION_JSON_TYPE)
-      .get()
-    var log = logResponse.readEntity(classOf[OperationLog])
+    var logResponse: Response = null
+    var log: OperationLog = null
+    eventually(timeout(10.seconds), interval(1.seconds)) {
+      logResponse = webTarget.path(s"api/v1/batches/${batch.getId()}/localLog")
+        .queryParam("from", "0")
+        .queryParam("size", "1")
+        .request(MediaType.APPLICATION_JSON_TYPE)
+        .get()
+      log = logResponse.readEntity(classOf[OperationLog])
+      assert(log.getRowCount == 1)
+    }
     val head = log.getLogRowSet.asScala.head
-    assert(log.getRowCount == 1)
 
     val logs = new ArrayBuffer[String]
     logs.append(head)

Reply via email to