From 85af2c8340360b5a28bbcaece1c73e968b32cc65 Mon Sep 17 00:00:00 2001 From: TestBoost <153348110+TestBoost@users.noreply.github.com> Date: Mon, 11 Dec 2023 22:01:04 -0600 Subject: [PATCH] only create used and unused segments once to make the test faster (#15533) --- .../actions/RetrieveSegmentsActionsTest.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/actions/RetrieveSegmentsActionsTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/actions/RetrieveSegmentsActionsTest.java index 1b224b798567..24d2f0a90431 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/common/actions/RetrieveSegmentsActionsTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/actions/RetrieveSegmentsActionsTest.java @@ -28,8 +28,8 @@ import org.apache.druid.timeline.partition.NoneShardSpec; import org.joda.time.Interval; import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; +import org.junit.BeforeClass; +import org.junit.ClassRule; import org.junit.Test; import java.io.IOException; @@ -40,15 +40,15 @@ public class RetrieveSegmentsActionsTest { private static final Interval INTERVAL = Intervals.of("2017-10-01/2017-10-15"); - @Rule - public TaskActionTestKit actionTestKit = new TaskActionTestKit(); + @ClassRule + public static TaskActionTestKit actionTestKit = new TaskActionTestKit(); - private Task task; - private Set expectedUnusedSegments; - private Set expectedUsedSegments; + private static Task task; + private static Set expectedUnusedSegments; + private static Set expectedUsedSegments; - @Before - public void setup() throws IOException + @BeforeClass + public static void setup() throws IOException { task = NoopTask.create(); @@ -77,7 +77,7 @@ public void setup() throws IOException expectedUnusedSegments.forEach(s -> actionTestKit.getSegmentsMetadataManager().markSegmentAsUnused(s.getId())); } - private DataSegment createSegment(Interval interval, String version) + private static DataSegment createSegment(Interval interval, String version) { return new DataSegment( task.getDataSource(),