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

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 2c566eea2 Add preventive check in the test
2c566eea2 is described below

commit 2c566eea271d743a8acf03b79adaca6b49cb57c9
Author: Junkai Xue <[email protected]>
AuthorDate: Sun May 17 20:24:14 2026 -0700

    Add preventive check in the test
---
 .../helix/integration/task/TestStopWorkflow.java     | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestStopWorkflow.java
 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestStopWorkflow.java
index 51b03bfa4..5fb9a006e 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/task/TestStopWorkflow.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/task/TestStopWorkflow.java
@@ -149,6 +149,11 @@ public class TestStopWorkflow extends TaskTestBase {
     _driver.stop(workflowNameToStop);
 
     _driver.pollForWorkflowState(workflowNameToStop, TaskState.STOPPED);
+
+    // Wait for task quotas to be released after stopping the workflow
+    // The stop operation transitions tasks to STOPPED state, but quota 
release may lag behind
+    waitForQuotaRelease(5000);
+
     Assert.assertEquals(
         TaskDriver.getWorkflowContext(_manager, 
workflowNameToStop).getWorkflowState(),
         TaskState.STOPPED); // Check that the workflow has been stopped
@@ -331,4 +336,19 @@ public class TestStopWorkflow extends TaskTestBase {
       _stopFlag = true;
     }
   }
+
+  /**
+   * Waits for task quotas to be released after stopping a workflow.
+   * When a workflow is stopped, tasks may take time to release their quotas.
+   * This method provides a small delay to allow quota release to propagate.
+   *
+   * @param waitTimeMs Maximum time to wait in milliseconds
+   */
+  private void waitForQuotaRelease(int waitTimeMs) {
+    try {
+      Thread.sleep(waitTimeMs);
+    } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
+    }
+  }
 }

Reply via email to