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

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


The following commit(s) were added to refs/heads/master by this push:
     new bc071ff7c93 [fix](regression) Wait past unsafe time boundaries (#65742)
bc071ff7c93 is described below

commit bc071ff7c93f60f4c7f92317f43c32b779496bd7
Author: Gabriel <[email protected]>
AuthorDate: Fri Jul 17 23:04:50 2026 +0800

    [fix](regression) Wait past unsafe time boundaries (#65742)
    
    The regression framework truncated the remaining time
    before an hour or day boundary to whole seconds. Sleeping for that
    truncated value could resume in the final fractional second before the
    boundary, allowing a boundary-sensitive case to cross it and fail
    intermittently. This change computes the wait in milliseconds and sleeps
    one additional millisecond so execution resumes strictly after the
    boundary. It also adds focused coverage for fractional, exact, and safe
    boundary windows and aligns the JUnit API with the engine already
    provided by Groovy.
---
 regression-test/framework/pom.xml                  |  2 +-
 .../org/apache/doris/regression/suite/Suite.groovy | 34 ++++++-------
 .../regression/suite/SuiteBoundaryWaitTest.groovy  | 56 ++++++++++++++++++++++
 run-regression-test.sh                             |  3 +-
 4 files changed, 76 insertions(+), 19 deletions(-)

diff --git a/regression-test/framework/pom.xml 
b/regression-test/framework/pom.xml
index 45b589185b8..52660d5bcff 100644
--- a/regression-test/framework/pom.xml
+++ b/regression-test/framework/pom.xml
@@ -266,7 +266,7 @@ under the License.
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-api</artifactId>
-            <version>5.8.2</version>
+            <version>5.10.2</version>
         </dependency>
         <dependency>
             <groupId>mysql</groupId>
diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index 832669de082..cedb00cc0e3 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -3753,35 +3753,35 @@ class Suite implements GroovyInterceptable {
             throw new IllegalArgumentException("invalid caseElapseSeconds, 
${caseElapseSeconds}")
         }
 
-        long sleepSeconds = 0
-        LocalDateTime now = LocalDateTime.now();
+        LocalDateTime now = LocalDateTime.now()
+        LocalDateTime boundary
 
         switch (caseSpanConstraint) {
             case "NOT_CROSS_HOUR_BOUNDARY":
-                LocalDateTime nextHour = 
now.withMinute(0).withSecond(0).withNano(0).plusHours(1);
-                long secondsToNextHour = ChronoUnit.SECONDS.between(now, 
nextHour)
-
-                if (secondsToNextHour < caseElapseSeconds) {
-                    sleepSeconds = secondsToNextHour
-                }
+                boundary = 
now.withMinute(0).withSecond(0).withNano(0).plusHours(1)
                 break
 
             case "NOT_CROSS_DAY_BOUNDARY":
-                LocalDateTime startOfNextDay = 
now.toLocalDate().plusDays(1).atStartOfDay();
-                long secondsToNextDay = ChronoUnit.SECONDS.between(now, 
startOfNextDay)
-
-                if (secondsToNextDay < caseElapseSeconds) {
-                    sleepSeconds = secondsToNextDay
-                }
+                boundary = now.toLocalDate().plusDays(1).atStartOfDay()
                 break
             default:
                 throw new IllegalArgumentException("invalid 
caseSpanConstraint:${caseSpanConstraint}")
         }
 
-        if (sleepSeconds > 0) {
-            logger.info("test sleeps ${sleepSeconds} to satisfy 
${caseSpanConstraint}")
-            Thread.sleep(sleepSeconds * 1000)
+        long sleepMillis = calculateBoundarySleepMillis(now, boundary, 
caseElapseSeconds)
+        if (sleepMillis > 0) {
+            logger.info("test sleeps ${sleepMillis} ms to satisfy 
${caseSpanConstraint}")
+            Thread.sleep(sleepMillis)
+        }
+    }
+
+    static long calculateBoundarySleepMillis(LocalDateTime now, LocalDateTime 
boundary, int caseElapseSeconds) {
+        long millisToBoundary = ChronoUnit.MILLIS.between(now, boundary)
+        if (millisToBoundary <= TimeUnit.SECONDS.toMillis(caseElapseSeconds)) {
+            // Cross the boundary by a full millisecond; truncated fractional 
milliseconds must not resume early.
+            return millisToBoundary + 1
         }
+        return 0
     }
 
     void retryUntilHasSqlCache(String sql) {
diff --git 
a/regression-test/framework/src/test/groovy/org/apache/doris/regression/suite/SuiteBoundaryWaitTest.groovy
 
b/regression-test/framework/src/test/groovy/org/apache/doris/regression/suite/SuiteBoundaryWaitTest.groovy
new file mode 100644
index 00000000000..4b8693e7678
--- /dev/null
+++ 
b/regression-test/framework/src/test/groovy/org/apache/doris/regression/suite/SuiteBoundaryWaitTest.groovy
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.regression.suite
+
+import org.junit.jupiter.api.Test
+
+import java.time.LocalDateTime
+import java.util.concurrent.TimeUnit
+
+import static org.junit.jupiter.api.Assertions.assertEquals
+import static org.junit.jupiter.api.Assertions.assertTrue
+
+class SuiteBoundaryWaitTest {
+    @Test
+    void waitCrossesBoundaryWhenRemainingTimeHasFractionalSecond() {
+        LocalDateTime now = 
LocalDateTime.parse("2026-07-16T22:59:40.285999999")
+        LocalDateTime nextHour = LocalDateTime.parse("2026-07-16T23:00:00")
+
+        long waitMillis = Suite.calculateBoundarySleepMillis(now, nextHour, 45)
+
+        
assertTrue(now.plusNanos(TimeUnit.MILLISECONDS.toNanos(waitMillis)).isAfter(nextHour))
+    }
+
+    @Test
+    void waitCrossesBoundaryWhenExpectedDurationEndsExactlyAtBoundary() {
+        LocalDateTime now = LocalDateTime.parse("2026-07-16T22:59:15")
+        LocalDateTime nextHour = LocalDateTime.parse("2026-07-16T23:00:00")
+
+        long waitMillis = Suite.calculateBoundarySleepMillis(now, nextHour, 45)
+
+        
assertTrue(now.plusNanos(TimeUnit.MILLISECONDS.toNanos(waitMillis)).isAfter(nextHour))
+    }
+
+    @Test
+    void noWaitWhenExpectedDurationFinishesBeforeBoundary() {
+        LocalDateTime now = LocalDateTime.parse("2026-07-16T22:59:14.999")
+        LocalDateTime nextHour = LocalDateTime.parse("2026-07-16T23:00:00")
+
+        assertEquals(0, Suite.calculateBoundarySleepMillis(now, nextHour, 45))
+    }
+}
diff --git a/run-regression-test.sh b/run-regression-test.sh
index 87143a2cda5..a81cb880e50 100755
--- a/run-regression-test.sh
+++ b/run-regression-test.sh
@@ -212,7 +212,8 @@ if ! test -f ${RUN_JAR:+${RUN_JAR}}; then
     
     # Then package with retry
     echo "Building package..."
-    execute_maven_with_retry "${MVN_CMD} clean package -B -DskipTests=true 
-Dmaven.javadoc.skip=true" || {
+    # Keep framework unit tests in the standard compile path so pipeline 
builds enforce framework regressions.
+    execute_maven_with_retry "${MVN_CMD} clean package -B 
-Dmaven.javadoc.skip=true" || {
         echo "Failed to build package"
         exit 1
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to