Skip to content

Commit

Permalink
fix: compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
salvatore-campagna committed Jul 13, 2023
1 parent a06ccab commit 45f0d99
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;

public class DataLifecycleTests extends AbstractXContentSerializingTestCase<DataLifecycle> {

public static final TimeValue TIMEOUT = new TimeValue(1, TimeUnit.MINUTES);

@Override
protected Writeable.Reader<DataLifecycle> instanceReader() {
return DataLifecycle::new;
Expand Down Expand Up @@ -151,11 +154,11 @@ public void testInvalidDownsamplingConfiguration() {
List.of(
new DataLifecycle.Downsampling.Round(
TimeValue.timeValueDays(10),
new DownsampleConfig(new DateHistogramInterval("2h"))
new DownsampleConfig(new DateHistogramInterval("2h"), TIMEOUT)
),
new DataLifecycle.Downsampling.Round(
TimeValue.timeValueDays(3),
new DownsampleConfig(new DateHistogramInterval("2h"))
new DownsampleConfig(new DateHistogramInterval("2h"), TIMEOUT)
)
)
)
Expand All @@ -172,11 +175,11 @@ public void testInvalidDownsamplingConfiguration() {
List.of(
new DataLifecycle.Downsampling.Round(
TimeValue.timeValueDays(10),
new DownsampleConfig(new DateHistogramInterval("2h"))
new DownsampleConfig(new DateHistogramInterval("2h"), TIMEOUT)
),
new DataLifecycle.Downsampling.Round(
TimeValue.timeValueDays(30),
new DownsampleConfig(new DateHistogramInterval("2h"))
new DownsampleConfig(new DateHistogramInterval("2h"), TIMEOUT)
)
)
)
Expand All @@ -190,11 +193,11 @@ public void testInvalidDownsamplingConfiguration() {
List.of(
new DataLifecycle.Downsampling.Round(
TimeValue.timeValueDays(10),
new DownsampleConfig(new DateHistogramInterval("2h"))
new DownsampleConfig(new DateHistogramInterval("2h"), TIMEOUT)
),
new DataLifecycle.Downsampling.Round(
TimeValue.timeValueDays(30),
new DownsampleConfig(new DateHistogramInterval("3h"))
new DownsampleConfig(new DateHistogramInterval("3h"), TIMEOUT)
)
)
)
Expand Down Expand Up @@ -234,7 +237,7 @@ private static DataLifecycle.Downsampling randomDownsampling() {
List<DataLifecycle.Downsampling.Round> rounds = new ArrayList<>();
var previous = new DataLifecycle.Downsampling.Round(
TimeValue.timeValueDays(randomIntBetween(1, 365)),
new DownsampleConfig(new DateHistogramInterval(randomIntBetween(1, 24) + "h"))
new DownsampleConfig(new DateHistogramInterval(randomIntBetween(1, 24) + "h"), TIMEOUT)
);
rounds.add(previous);
for (int i = 0; i < count; i++) {
Expand All @@ -250,7 +253,8 @@ private static DataLifecycle.Downsampling randomDownsampling() {
private static DataLifecycle.Downsampling.Round nextRound(DataLifecycle.Downsampling.Round previous) {
var after = TimeValue.timeValueDays(previous.after().days() + randomIntBetween(1, 10));
var fixedInterval = new DownsampleConfig(
new DateHistogramInterval((previous.config().getFixedInterval().estimateMillis() * randomIntBetween(2, 5)) + "ms")
new DateHistogramInterval((previous.config().getFixedInterval().estimateMillis() * randomIntBetween(2, 5)) + "ms"),
TIMEOUT
);
return new DataLifecycle.Downsampling.Round(after, fixedInterval);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@

public class MetadataIndexTemplateServiceTests extends ESSingleNodeTestCase {

public static final TimeValue TIMEOUT = new TimeValue(1, TimeUnit.MINUTES);

@Override
protected Settings nodeSettings() {
// Disable the health node selection so the task assignment does not interfere with the cluster state during the test
Expand Down Expand Up @@ -1512,7 +1514,10 @@ public void testResolveLifecycle() throws Exception {
new DataLifecycle.Retention(TimeValue.timeValueDays(45)),
new DataLifecycle.Downsampling(
List.of(
new DataLifecycle.Downsampling.Round(TimeValue.timeValueDays(30), new DownsampleConfig(new DateHistogramInterval("3h")))
new DataLifecycle.Downsampling.Round(
TimeValue.timeValueDays(30),
new DownsampleConfig(new DateHistogramInterval("3h"), TIMEOUT)
)
)
)
);
Expand Down

0 comments on commit 45f0d99

Please sign in to comment.