Skip to content

Commit c9c739d

Browse files
committed
Unmute RollupActionSingleNodeTests
this commit unmutes the tests so that more CI runs with new code that includes better error messages will highlight why tests are flaky. relates elastic#69506, elastic#69799, elastic#69733.
1 parent 8a9055a commit c9c739d

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/v2/TransportRollupAction.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
/**
6464
* The master rollup action that coordinates
6565
* - creating rollup temporary index
66-
* - calling {@link TransportRollupIndexerAction} to index rolluped up documents
66+
* - calling {@link TransportRollupIndexerAction} to index rollup-ed documents
6767
* - cleaning up state
6868
*/
6969
public class TransportRollupAction extends AcknowledgedTransportMasterNodeAction<RollupAction.Request> {
@@ -139,9 +139,11 @@ protected void masterOperation(Task task, RollupAction.Request request, ClusterS
139139
// 3. run rollup indexer
140140
// 4. make temp index read-only
141141
// 5. shrink index
142-
// 6. delete temporary index
142+
// 6. publish rollup metadata and add rollup index to datastream
143+
// 7. delete temporary index
143144
// at any point if there is an issue, then cleanup temp index
144145

146+
// 1.
145147
client.fieldCaps(fieldCapsRequest, ActionListener.wrap(fieldCapsResponse -> {
146148
RollupActionRequestValidationException validationException = new RollupActionRequestValidationException();
147149
if (fieldCapsResponse.get().size() == 0) {
@@ -156,6 +158,7 @@ protected void masterOperation(Task task, RollupAction.Request request, ClusterS
156158
return;
157159
}
158160

161+
// 2.
159162
clusterService.submitStateUpdateTask("rollup create index", new ClusterStateUpdateTask() {
160163
@Override
161164
public ClusterState execute(ClusterState currentState) throws Exception {
@@ -170,12 +173,16 @@ public ClusterState execute(ClusterState currentState) throws Exception {
170173

171174
public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
172175
// index created
176+
// 3.
173177
client.execute(RollupIndexerAction.INSTANCE, rollupIndexerRequest, ActionListener.wrap(indexerResp -> {
174178
if (indexerResp.isCreated()) {
179+
// 4.
175180
client.admin().indices().updateSettings(updateSettingsReq, ActionListener.wrap(updateSettingsResponse -> {
176181
if (updateSettingsResponse.isAcknowledged()) {
182+
// 5.
177183
client.admin().indices().resizeIndex(resizeRequest, ActionListener.wrap(resizeResponse -> {
178184
if (resizeResponse.isAcknowledged()) {
185+
// 6.
179186
publishMetadata(originalIndexName, tmpIndexName, rollupIndexName, listener);
180187
} else {
181188
deleteTmpIndex(originalIndexName, tmpIndexName, listener,

x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/v2/RollupActionSingleNodeTests.java

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
package org.elasticsearch.xpack.rollup.v2;
88

9-
import org.apache.lucene.util.LuceneTestCase;
109
import org.elasticsearch.ElasticsearchException;
1110
import org.elasticsearch.ResourceAlreadyExistsException;
1211
import org.elasticsearch.action.ActionListener;
@@ -83,7 +82,6 @@
8382
import static org.hamcrest.Matchers.containsString;
8483
import static org.hamcrest.Matchers.equalTo;
8584

86-
@LuceneTestCase.AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/69799")
8785
public class RollupActionSingleNodeTests extends ESSingleNodeTestCase {
8886

8987
private static final DateFormatter DATE_FORMATTER = DateFormatter.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
@@ -130,7 +128,6 @@ public void tearDown() throws Exception {
130128
super.tearDown();
131129
}
132130

133-
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/69506")
134131
public void testRollupShardIndexerCleansTempFiles() throws IOException {
135132
// create rollup config and index documents into source index
136133
RollupActionDateHistogramGroupConfig dateHistogramGroupConfig = randomRollupActionDateHistogramGroupConfig("date_1");
@@ -152,8 +149,8 @@ public void testRollupShardIndexerCleansTempFiles() throws IOException {
152149
// re-use source index as temp index for test
153150
RollupShardIndexer indexer = new RollupShardIndexer(client(), indexService, shard.shardId(), config, index, 2);
154151
indexer.execute();
155-
assertThat(indexer.tmpFilesDeleted, equalTo(indexer.tmpFiles));
156152
// assert that files are deleted
153+
assertThat(indexer.tmpFilesDeleted, equalTo(indexer.tmpFiles));
157154
}
158155

159156
public void testCannotRollupToExistingIndex() throws Exception {
@@ -173,21 +170,14 @@ public void testCannotRollupToExistingIndex() throws Exception {
173170
assertThat(exception.getMessage(), containsString("Unable to rollup index [" + index + "]"));
174171
}
175172

176-
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/69506")
177-
public void testTemporaryIndexDeletedOnRollupFailure() throws Exception {
173+
public void testTemporaryIndexCannotBeCreatedAlreadyExists() {
178174
RollupActionDateHistogramGroupConfig dateHistogramGroupConfig = randomRollupActionDateHistogramGroupConfig("date_1");
179-
SourceSupplier sourceSupplier = () -> XContentFactory.jsonBuilder().startObject()
180-
.field("date_1", randomDateForInterval(dateHistogramGroupConfig.getInterval()))
181-
.field("categorical_1", randomAlphaOfLength(1))
182-
.endObject();
183175
RollupActionConfig config = new RollupActionConfig(
184176
new RollupActionGroupConfig(dateHistogramGroupConfig, null, new TermsGroupConfig("categorical_1")),
185-
Collections.singletonList(new MetricConfig("numeric_non_existent", Collections.singletonList("max"))));
186-
bulkIndex(sourceSupplier);
187-
expectThrows(ElasticsearchException.class, () -> rollup(index, rollupIndex, config));
188-
// assert that temporary index was removed
189-
expectThrows(IndexNotFoundException.class,
190-
() -> client().admin().indices().prepareGetIndex().addIndices(".rolluptmp-" + rollupIndex).get());
177+
Collections.singletonList(new MetricConfig("numeric_1", Collections.singletonList("max"))));
178+
assertTrue(client().admin().indices().prepareCreate(".rolluptmp-" + rollupIndex).get().isAcknowledged());
179+
Exception exception = expectThrows(ElasticsearchException.class, () -> rollup(index, rollupIndex, config));
180+
assertThat(exception.getMessage(), containsString("already exists"));
191181
}
192182

193183
public void testCannotRollupWhileOtherRollupInProgress() throws Exception {

0 commit comments

Comments
 (0)