Skip to content

Commit f2a05ea

Browse files
authored
Test fix: use the same random sampling method throughout the test. (#137506)
Fixes #137489
1 parent 4d3e27f commit f2a05ea

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,6 @@ tests:
498498
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
499499
method: test {yaml=indices.validate_query/20_query_string/validate_query with query_string parameters}
500500
issue: https://github.com/elastic/elasticsearch/issues/137391
501-
- class: org.elasticsearch.xpack.downsample.ILMDownsampleDisruptionIT
502-
method: testILMDownsampleRollingRestart
503-
issue: https://github.com/elastic/elasticsearch/issues/137489
504501
- class: org.elasticsearch.smoketest.SmokeTestIngestWithAllDepsClientYamlTestSuiteIT
505502
method: test {yaml=ingest/100_sampling_with_reroute/Test get sample with multiple reroutes}
506503
issue: https://github.com/elastic/elasticsearch/issues/137457

x-pack/plugin/downsample/src/internalClusterTest/java/org/elasticsearch/xpack/downsample/ILMDownsampleDisruptionIT.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
5757
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertResponse;
5858
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
59-
import static org.elasticsearch.xpack.core.rollup.ConfigTestHelpers.randomInterval;
6059
import static org.hamcrest.Matchers.equalTo;
6160

6261
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, numClientNodes = 4)
@@ -87,7 +86,8 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
8786
return nodeSettings.build();
8887
}
8988

90-
public void setup(final String sourceIndex, int numOfShards, int numOfReplicas, long startTime) throws IOException {
89+
public void setup(final String sourceIndex, int numOfShards, int numOfReplicas, long startTime, DownsampleConfig config)
90+
throws IOException {
9191
final Settings.Builder settings = indexSettings(numOfShards, numOfReplicas).put(IndexSettings.MODE.getKey(), IndexMode.TIME_SERIES)
9292
.putList(IndexMetadata.INDEX_ROUTING_PATH.getKey(), List.of(FIELD_DIMENSION_KEYWORD))
9393
.put(
@@ -123,10 +123,10 @@ public void setup(final String sourceIndex, int numOfShards, int numOfReplicas,
123123
Map.of(
124124
"downsample",
125125
new org.elasticsearch.xpack.core.ilm.DownsampleAction(
126-
DateHistogramInterval.HOUR,
126+
config.getFixedInterval(),
127127
null,
128128
randomBoolean(),
129-
randomSamplingMethod()
129+
config.getSamplingMethod()
130130
)
131131
)
132132
)
@@ -145,9 +145,9 @@ public void testILMDownsampleRollingRestart() throws Exception {
145145

146146
final String sourceIndex = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
147147
long startTime = LocalDateTime.parse("1993-09-09T18:00:00").atZone(ZoneId.of("UTC")).toInstant().toEpochMilli();
148-
setup(sourceIndex, 1, 0, startTime);
149148
DownsampleConfig.SamplingMethod samplingMethod = randomSamplingMethod();
150-
final DownsampleConfig config = new DownsampleConfig(randomInterval(), samplingMethod);
149+
final DownsampleConfig config = new DownsampleConfig(DateHistogramInterval.HOUR, samplingMethod);
150+
setup(sourceIndex, 1, 0, startTime, config);
151151
final Supplier<XContentBuilder> sourceSupplier = () -> {
152152
final String ts = randomDateForInterval(config.getInterval(), startTime);
153153
double counterValue = DATE_FORMATTER.parseMillis(ts);

0 commit comments

Comments
 (0)