6
6
*/
7
7
package org .elasticsearch .xpack .rollup .v2 ;
8
8
9
- import org .apache .lucene .util .LuceneTestCase ;
10
9
import org .elasticsearch .ElasticsearchException ;
11
10
import org .elasticsearch .ResourceAlreadyExistsException ;
12
11
import org .elasticsearch .action .ActionListener ;
83
82
import static org .hamcrest .Matchers .containsString ;
84
83
import static org .hamcrest .Matchers .equalTo ;
85
84
86
- @ LuceneTestCase .AwaitsFix (bugUrl ="https://github.com/elastic/elasticsearch/issues/69799" )
87
85
public class RollupActionSingleNodeTests extends ESSingleNodeTestCase {
88
86
89
87
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 {
130
128
super .tearDown ();
131
129
}
132
130
133
- @ AwaitsFix (bugUrl ="https://github.com/elastic/elasticsearch/issues/69506" )
134
131
public void testRollupShardIndexerCleansTempFiles () throws IOException {
135
132
// create rollup config and index documents into source index
136
133
RollupActionDateHistogramGroupConfig dateHistogramGroupConfig = randomRollupActionDateHistogramGroupConfig ("date_1" );
@@ -152,8 +149,8 @@ public void testRollupShardIndexerCleansTempFiles() throws IOException {
152
149
// re-use source index as temp index for test
153
150
RollupShardIndexer indexer = new RollupShardIndexer (client (), indexService , shard .shardId (), config , index , 2 );
154
151
indexer .execute ();
155
- assertThat (indexer .tmpFilesDeleted , equalTo (indexer .tmpFiles ));
156
152
// assert that files are deleted
153
+ assertThat (indexer .tmpFilesDeleted , equalTo (indexer .tmpFiles ));
157
154
}
158
155
159
156
public void testCannotRollupToExistingIndex () throws Exception {
@@ -173,21 +170,14 @@ public void testCannotRollupToExistingIndex() throws Exception {
173
170
assertThat (exception .getMessage (), containsString ("Unable to rollup index [" + index + "]" ));
174
171
}
175
172
176
- @ AwaitsFix (bugUrl ="https://github.com/elastic/elasticsearch/issues/69506" )
177
- public void testTemporaryIndexDeletedOnRollupFailure () throws Exception {
173
+ public void testTemporaryIndexCannotBeCreatedAlreadyExists () {
178
174
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 ();
183
175
RollupActionConfig config = new RollupActionConfig (
184
176
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" ));
191
181
}
192
182
193
183
public void testCannotRollupWhileOtherRollupInProgress () throws Exception {
0 commit comments