From a3a7ec9d4f71e3f9f9540067113222ad1f3fdda0 Mon Sep 17 00:00:00 2001 From: Javier Aliaga Date: Thu, 12 Feb 2026 17:02:01 +0100 Subject: [PATCH 1/5] chore: Fix waitForLoopEvent test Signed-off-by: Javier Aliaga --- .../dapr/durabletask/DurableTaskClientIT.java | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java b/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java index 85c7de0e41..906ef60855 100644 --- a/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java +++ b/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java @@ -12,13 +12,13 @@ */ package io.dapr.durabletask; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.time.Duration; @@ -42,11 +42,13 @@ import java.util.stream.IntStream; import java.util.stream.Stream; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Tag; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * These integration tests are designed to exercise the core, high-level features of @@ -59,6 +61,7 @@ @Tag("integration") public class DurableTaskClientIT extends IntegrationTestBase { static final Duration defaultTimeout = Duration.ofSeconds(100); + private static final Logger log = LoggerFactory.getLogger(DurableTaskClientIT.class); // All tests that create a server should save it to this variable for proper shutdown private DurableTaskGrpcWorker server; @@ -192,10 +195,10 @@ void loopWithWaitForEvent() throws IOException, TimeoutException { ctx.waitForExternalEvent("HELLO", delay).await(); } catch (TaskCanceledException tce) { if (!ctx.getIsReplaying()) { - timestamps.set(counter.get(), LocalDateTime.now()); + var t = LocalDateTime.now(); + timestamps.set(counter.get(), t); counter.incrementAndGet(); } - } } }) @@ -218,18 +221,20 @@ void loopWithWaitForEvent() throws IOException, TimeoutException { assertEquals(4, counter.get()); // Verify that each timer is the expected length - int[] secondsElapsed = new int[timestamps.length()]; + long[] millisElapsed = new long[timestamps.length()]; for (int i = 0; i < timestamps.length() - 1; i++) { if (timestamps.get(i + 1) != null && timestamps.get(i) != null) { - secondsElapsed[i] = timestamps.get(i + 1).getSecond() - timestamps.get(i).getSecond(); + millisElapsed[i] = + java.time.Duration.between(timestamps.get(i), timestamps.get(i + 1)).toMillis(); } else { - secondsElapsed[i] = -1; + millisElapsed[i] = -1; } } - assertEquals(2, secondsElapsed[0]); - assertEquals(2, secondsElapsed[1]); - assertEquals(2, secondsElapsed[2]); - assertEquals(0, secondsElapsed[3]); + + assertEquals(2000, millisElapsed[0], 20); + assertEquals(2000, millisElapsed[1], 20); + assertEquals(2000, millisElapsed[2], 20); + assertEquals(0, millisElapsed[3]); } From e3385cd381e3ad4856fcd4a4539b362e68aac827 Mon Sep 17 00:00:00 2001 From: Javier Aliaga Date: Thu, 12 Feb 2026 17:07:28 +0100 Subject: [PATCH 2/5] fix: Code style Signed-off-by: Javier Aliaga --- .../test/java/io/dapr/durabletask/DurableTaskClientIT.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java b/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java index 906ef60855..1126f35cc8 100644 --- a/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java +++ b/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java @@ -17,8 +17,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.io.IOException; import java.time.Duration; @@ -61,7 +59,6 @@ @Tag("integration") public class DurableTaskClientIT extends IntegrationTestBase { static final Duration defaultTimeout = Duration.ofSeconds(100); - private static final Logger log = LoggerFactory.getLogger(DurableTaskClientIT.class); // All tests that create a server should save it to this variable for proper shutdown private DurableTaskGrpcWorker server; @@ -195,8 +192,7 @@ void loopWithWaitForEvent() throws IOException, TimeoutException { ctx.waitForExternalEvent("HELLO", delay).await(); } catch (TaskCanceledException tce) { if (!ctx.getIsReplaying()) { - var t = LocalDateTime.now(); - timestamps.set(counter.get(), t); + timestamps.set(counter.get(), LocalDateTime.now()); counter.incrementAndGet(); } } From 2f4eba7483c0c3813c7fc12f2cd015a6a6d048e4 Mon Sep 17 00:00:00 2001 From: Javier Aliaga Date: Thu, 12 Feb 2026 17:20:03 +0100 Subject: [PATCH 3/5] chore: Fix singleTimer Test Signed-off-by: Javier Aliaga --- .../test/java/io/dapr/durabletask/DurableTaskClientIT.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java b/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java index 1126f35cc8..27c593e2c1 100644 --- a/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java +++ b/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java @@ -118,11 +118,11 @@ void singleTimer() throws IOException, TimeoutException { assertEquals(2, counter.get()); // Verify that each timer is the expected length - int[] secondsElapsed = new int[1]; + long[] millisElapsed = new long[1]; for (int i = 0; i < timestamps.length() - 1; i++) { - secondsElapsed[i] = timestamps.get(i + 1).getSecond() - timestamps.get(i).getSecond(); + millisElapsed[i] = Duration.between(timestamps.get(i), timestamps.get(i + 1)).toMillis(); } - assertEquals(3, secondsElapsed[0]); + assertEquals(3000, millisElapsed[0], 20); } } From b96fcd5cf3062a79d7b3034163f9a1c988ef1a7c Mon Sep 17 00:00:00 2001 From: Javier Aliaga Date: Thu, 12 Feb 2026 17:25:48 +0100 Subject: [PATCH 4/5] chore: Fix LoopWithTimer Signed-off-by: Javier Aliaga --- .../dapr/durabletask/DurableTaskClientIT.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java b/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java index 27c593e2c1..eae76571f1 100644 --- a/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java +++ b/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java @@ -122,7 +122,7 @@ void singleTimer() throws IOException, TimeoutException { for (int i = 0; i < timestamps.length() - 1; i++) { millisElapsed[i] = Duration.between(timestamps.get(i), timestamps.get(i + 1)).toMillis(); } - assertEquals(3000, millisElapsed[0], 20); + assertEquals(3000, millisElapsed[0], 50); } } @@ -163,19 +163,17 @@ void loopWithTimer() throws IOException, TimeoutException { assertEquals(3, counter.get()); // Verify that each timer is the expected length - int[] secondsElapsed = new int[timestamps.length()]; + long[] millisElapsed = new long[timestamps.length()]; for (int i = 0; i < timestamps.length() - 1; i++) { if (timestamps.get(i + 1) != null && timestamps.get(i) != null) { - secondsElapsed[i] = timestamps.get(i + 1).getSecond() - timestamps.get(i).getSecond(); + millisElapsed[i] = Duration.between(timestamps.get(i), timestamps.get(i + 1)).toMillis(); } else { - secondsElapsed[i] = -1; + millisElapsed[i] = -1; } } - assertEquals(2, secondsElapsed[0]); - assertEquals(2, secondsElapsed[1]); - assertEquals(-1, secondsElapsed[2]); - - + assertEquals(2000, millisElapsed[0], 50); + assertEquals(2000, millisElapsed[1], 50); + assertEquals(-1, millisElapsed[2]); } } @@ -227,9 +225,9 @@ void loopWithWaitForEvent() throws IOException, TimeoutException { } } - assertEquals(2000, millisElapsed[0], 20); - assertEquals(2000, millisElapsed[1], 20); - assertEquals(2000, millisElapsed[2], 20); + assertEquals(2000, millisElapsed[0], 50); + assertEquals(2000, millisElapsed[1], 50); + assertEquals(2000, millisElapsed[2], 50); assertEquals(0, millisElapsed[3]); From a9515a544d63d80b013719e4907fabd17bd59482 Mon Sep 17 00:00:00 2001 From: Javier Aliaga Date: Thu, 12 Feb 2026 17:30:18 +0100 Subject: [PATCH 5/5] fix: longTimer test Signed-off-by: Javier Aliaga --- .../java/io/dapr/durabletask/DurableTaskClientIT.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java b/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java index eae76571f1..3863e01d6b 100644 --- a/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java +++ b/durabletask-client/src/test/java/io/dapr/durabletask/DurableTaskClientIT.java @@ -268,13 +268,13 @@ void longTimer() throws TimeoutException { assertEquals(4, counter.get()); // Verify that each timer is the expected length - int[] secondsElapsed = new int[3]; + long[] millisElapsed = new long[3]; for (int i = 0; i < timestamps.length() - 1; i++) { - secondsElapsed[i] = timestamps.get(i + 1).getSecond() - timestamps.get(i).getSecond(); + millisElapsed[i] = Duration.between(timestamps.get(i), timestamps.get(i + 1)).toMillis(); } - assertEquals(secondsElapsed[0], 3); - assertEquals(secondsElapsed[1], 3); - assertEquals(secondsElapsed[2], 1); + assertEquals(3000, millisElapsed[0], 50); + assertEquals(3000, millisElapsed[1], 50); + assertEquals(1000, millisElapsed[2], 50); } }