You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ji...@apache.org on 2022/11/14 09:43:33 UTC

[dolphinscheduler] branch 2.0.8-prepare updated: [Bugfix-12603] Dependency conditions for the last 24 hours of the dependent task did not take effect (#12862)

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

jinyleechina pushed a commit to branch 2.0.8-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/2.0.8-prepare by this push:
     new de76f81072 [Bugfix-12603] Dependency conditions for the last 24 hours of the dependent task did not take effect (#12862)
de76f81072 is described below

commit de76f810722870e9bf1f2c042ec2eaf882b87e1c
Author: Molin Wang <wc...@gmail.com>
AuthorDate: Mon Nov 14 17:43:25 2022 +0800

    [Bugfix-12603] Dependency conditions for the last 24 hours of the dependent task did not take effect (#12862)
---
 .../org/apache/dolphinscheduler/common/utils/DependentUtils.java  | 2 +-
 .../apache/dolphinscheduler/common/utils/DependentUtilsTest.java  | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DependentUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DependentUtils.java
index b8b6c1d13e..f3fde77dae 100644
--- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DependentUtils.java
+++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DependentUtils.java
@@ -84,7 +84,7 @@ public class DependentUtils {
                 result = DependentDateUtils.getLastHoursInterval(businessDate, 3);
                 break;
             case "last24Hours":
-                result = DependentDateUtils.getSpecialLastDayInterval(businessDate);
+                result = DependentDateUtils.getLastHoursInterval(businessDate, 24);
                 break;
             case "today":
                 result = DependentDateUtils.getTodayInterval(businessDate);
diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DependentUtilsTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DependentUtilsTest.java
index 40e3e5a8b0..5ed16f432e 100644
--- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DependentUtilsTest.java
+++ b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DependentUtilsTest.java
@@ -360,13 +360,13 @@ public class DependentUtilsTest {
 
     @Test
     public void testGetLast24Hour() {
-        Date curDay = DateUtils.stringToDate("2020-05-15 12:10:00");
+        Date curDay = DateUtils.stringToDate("2020-05-15 02:10:00");
         String dateValue = "last24Hours";
 
         List<DateInterval> dateIntervals = DependentUtils.getDateIntervalList(curDay, dateValue);
 
         List<DateInterval> expect = Lists.newArrayList();
-        for (int a = 1; a < 24; a++) {
+        for (int a = 2; a < 24; a++) {
             String i = a + "";
             if (a < 10) {
                 i = "0" + i;
@@ -374,8 +374,8 @@ public class DependentUtilsTest {
             DateInterval dateInterval = new DateInterval(DateUtils.getStartOfHour(DateUtils.stringToDate("2020-05-14 " + i + ":00:00")), DateUtils.getEndOfHour(DateUtils.stringToDate("2020-05-14 " + i + ":59:59")));
             expect.add(dateInterval);
         }
-        DateInterval dateInterval = new DateInterval(DateUtils.getStartOfHour(DateUtils.stringToDate("2020-05-15 00:00:00")), DateUtils.getEndOfHour(DateUtils.stringToDate("2020-05-15 00:59:59")));
-        expect.add(dateInterval);
+        expect.add(new DateInterval(DateUtils.getStartOfHour(DateUtils.stringToDate("2020-05-15 00:00:00")), DateUtils.getEndOfHour(DateUtils.stringToDate("2020-05-15 00:59:59"))));
+        expect.add(new DateInterval(DateUtils.getStartOfHour(DateUtils.stringToDate("2020-05-15 01:00:00")), DateUtils.getEndOfHour(DateUtils.stringToDate("2020-05-15 01:59:59"))));
 
         Assert.assertEquals(24, dateIntervals.size());