You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by di...@apache.org on 2022/12/08 15:39:55 UTC

[oozie] branch master updated: OOZIE-3685 Repair flaky testCoordActionInputCheckXCommandUniqueness unit test (jmakai via dionusos)

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

dionusos pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/oozie.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ce603f3e OOZIE-3685 Repair flaky testCoordActionInputCheckXCommandUniqueness unit test (jmakai via dionusos)
7ce603f3e is described below

commit 7ce603f3ec71a87b8f5b335c8c7602db9b44ed23
Author: Denes Bodo <di...@apache.org>
AuthorDate: Thu Dec 8 16:33:42 2022 +0100

    OOZIE-3685 Repair flaky testCoordActionInputCheckXCommandUniqueness unit test (jmakai via dionusos)
---
 .../command/coord/TestCoordActionInputCheckXCommand.java    |  6 ++----
 core/src/test/java/org/apache/oozie/test/XTestCase.java     | 13 ++++++++++++-
 release-log.txt                                             |  1 +
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java b/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
index a94997e4a..ead865e28 100644
--- a/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
+++ b/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
@@ -136,15 +136,13 @@ public class TestCoordActionInputCheckXCommand extends XDataTestCase {
 
         CallableQueueService queueservice = services.get(CallableQueueService.class);
 
-        for (MyCoordActionInputCheckXCommand c : callables) {
-            queueservice.queue(c);
-        }
+        queueservice.queueSerial(callables);
 
         waitFor(200, new Predicate() {
             public boolean evaluate() throws Exception {
                 return callable1.executed != 0 && callable2.executed == 0 && callable3.executed == 0;
             }
-        });
+        }, 50L);
 
         assertTrue(callable1.executed != 0);
         assertTrue(callable2.executed == 0);
diff --git a/core/src/test/java/org/apache/oozie/test/XTestCase.java b/core/src/test/java/org/apache/oozie/test/XTestCase.java
index f62e3df5e..cab0b5c85 100644
--- a/core/src/test/java/org/apache/oozie/test/XTestCase.java
+++ b/core/src/test/java/org/apache/oozie/test/XTestCase.java
@@ -788,6 +788,17 @@ public abstract class XTestCase extends TestCase {
      * @return the waited time.
      */
     protected long waitFor(int timeout, Predicate predicate) {
+        return waitFor(timeout, predicate, 1000L);
+    }
+
+    /**
+     * Wait for a condition, expressed via a {@link Predicate} to become true.
+     *
+     * @param timeout maximum time in milliseconds to wait for the predicate to become true.
+     * @param predicate predicate waiting on.
+     * @return the waited time.
+     */
+    protected long waitFor(int timeout, Predicate predicate, long waitTime) {
         Objects.requireNonNull(predicate, "predicate cannot be null");
         XLog log = new XLog(LogFactory.getLog(getClass()));
         long started = System.currentTimeMillis();
@@ -803,7 +814,7 @@ public abstract class XTestCase extends TestCase {
                     log.info("Waiting up to [{0}] msec", waiting);
                     lastEcho = System.currentTimeMillis();
                 }
-                Thread.sleep(1000);
+                Thread.sleep(waitTime);
             }
             if (!eval) {
                 log.info("Waiting timed out after [{0}] msec", timeout);
diff --git a/release-log.txt b/release-log.txt
index 2b63e9e52..15f3e58ff 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 5.3.0 release (trunk - unreleased)
 
+OOZIE-3685 Repair flaky testCoordActionInputCheckXCommandUniqueness unit test (jmakai via dionusos)
 OOZIE-3686 Repair flaky testRetryConsoleUrlForked unit test (jmakai via dionusos)
 OOZIE-3684 Migrate to commons-lang3 again (jmakai via dionusos)
 OOZIE-3682 Prepare ssh-wrapper script to handle callback specific arguments with quotes (jmakai via dionusos)