From 40033424a806199c67696ac42d6728b718566005 Mon Sep 17 00:00:00 2001 From: Zhangjian He Date: Sat, 11 Jan 2025 16:49:59 +0800 Subject: [PATCH] fix: add better annotation Signed-off-by: Zhangjian He --- .../common/testing/annotations/FlakyTest.java | 25 ++++++++++++++++++- ...stDynamicConfigurationFeatureProvider.java | 1 - 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/annotations/FlakyTest.java b/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/annotations/FlakyTest.java index e0a9db07d38..b595b695428 100644 --- a/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/annotations/FlakyTest.java +++ b/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/testing/annotations/FlakyTest.java @@ -27,7 +27,30 @@ import org.junit.jupiter.api.Test; /** - * Intended for marking a test case as flaky. + * Annotation to mark a test as flaky. + * + *

Flaky tests are tests that produce inconsistent results, + * occasionally failing or passing without changes to the code under test. + * This could be due to external factors such as timing issues, resource contention, + * dependency on non-deterministic data, or integration with external systems. + * + *

Tests marked with this annotation are excluded from execution + * in CI pipelines and Maven commands by default, to ensure a reliable and + * deterministic build process. However, they can still be executed manually + * or in specific environments for debugging and resolution purposes. + * + *

Usage: + *

+ * {@code
+ * @FlakyTest
+ * public void testSomething() {
+ *     // Test logic here
+ * }
+ * }
+ * 
+ * + *

It is recommended to investigate and address the root causes of flaky tests + * rather than relying on this annotation long-term. */ @Documented @Target({ ElementType.TYPE, ElementType.METHOD }) diff --git a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/feature/TestDynamicConfigurationFeatureProvider.java b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/feature/TestDynamicConfigurationFeatureProvider.java index 2bff8278d07..9a7b45a8d23 100644 --- a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/feature/TestDynamicConfigurationFeatureProvider.java +++ b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/feature/TestDynamicConfigurationFeatureProvider.java @@ -27,7 +27,6 @@ import org.apache.bookkeeper.stats.NullStatsLogger; import org.apache.distributedlog.DistributedLogConfiguration; import org.apache.distributedlog.common.config.PropertiesWriter; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout;