Skip to content

Commit

Permalink
only create used and unused segments once to make the test faster (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
TestBoost authored Dec 12, 2023
1 parent e8fcf2c commit 85af2c8
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<DataSegment> expectedUnusedSegments;
private Set<DataSegment> expectedUsedSegments;
private static Task task;
private static Set<DataSegment> expectedUnusedSegments;
private static Set<DataSegment> expectedUsedSegments;

@Before
public void setup() throws IOException
@BeforeClass
public static void setup() throws IOException
{
task = NoopTask.create();

Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 85af2c8

Please sign in to comment.