From be2082c27d2c673d1c8bda00a37924fcc271f9e8 Mon Sep 17 00:00:00 2001 From: Hongsheng Zhong Date: Tue, 17 Oct 2023 10:49:37 +0800 Subject: [PATCH] Improve SimpleMemoryPipelineChannelTest --- .../channel/memory/SimpleMemoryPipelineChannelTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/common/ingest/channel/memory/SimpleMemoryPipelineChannelTest.java b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/common/ingest/channel/memory/SimpleMemoryPipelineChannelTest.java index eebc8ef17dfa0..ad7af129271f1 100644 --- a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/common/ingest/channel/memory/SimpleMemoryPipelineChannelTest.java +++ b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/common/ingest/channel/memory/SimpleMemoryPipelineChannelTest.java @@ -31,11 +31,11 @@ void assertFetchRecordsTimeoutCorrectly() { SimpleMemoryPipelineChannel simpleMemoryPipelineChannel = new SimpleMemoryPipelineChannel(10, new EmptyAckCallback()); long startMills = System.currentTimeMillis(); simpleMemoryPipelineChannel.fetchRecords(1, 1, TimeUnit.MILLISECONDS); - long endMills = System.currentTimeMillis(); - assertTrue(endMills - startMills >= 1 && endMills - startMills < 50); + long delta = System.currentTimeMillis() - startMills; + assertTrue(delta >= 1 && delta < 50, "Delta is not in [1,50) : " + delta); startMills = System.currentTimeMillis(); simpleMemoryPipelineChannel.fetchRecords(1, 500, TimeUnit.MILLISECONDS); - endMills = System.currentTimeMillis(); - assertTrue(endMills - startMills >= 500 && endMills - startMills < 600); + delta = System.currentTimeMillis() - startMills; + assertTrue(delta >= 500 && delta < 650, "Delta is not in [500,650) : " + delta); } }