mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-30 10:23:41 -04:00
[TEST] Don't delete index from the clusterstate otherwise it might be concurrently removed
This commit is contained in:
parent
04dec8470a
commit
bc3b91eb57
1 changed files with 15 additions and 12 deletions
|
@ -49,7 +49,6 @@ public class IndicesLifecycleListenerSingleNodeTests extends ESSingleNodeTestCas
|
|||
ensureGreen();
|
||||
IndexMetaData metaData = indicesService.indexService("test").getMetaData();
|
||||
ShardRouting shardRouting = indicesService.indexService("test").getShard(0).routingEntry();
|
||||
assertAcked(client().admin().indices().prepareDelete("test").get());
|
||||
final AtomicInteger counter = new AtomicInteger(1);
|
||||
IndexEventListener countingListener = new IndexEventListener() {
|
||||
@Override
|
||||
|
@ -88,6 +87,8 @@ public class IndicesLifecycleListenerSingleNodeTests extends ESSingleNodeTestCas
|
|||
counter.incrementAndGet();
|
||||
}
|
||||
};
|
||||
indicesService.deleteIndex("test", "simon says");
|
||||
try {
|
||||
IndexService index = indicesService.createIndex(metaData, Arrays.asList(countingListener));
|
||||
ShardRouting newRouting = new ShardRouting(shardRouting);
|
||||
String nodeId = newRouting.currentNodeId();
|
||||
|
@ -99,7 +100,9 @@ public class IndicesLifecycleListenerSingleNodeTests extends ESSingleNodeTestCas
|
|||
newRouting = new ShardRouting(newRouting);
|
||||
ShardRoutingHelper.moveToStarted(newRouting);
|
||||
shard.updateRoutingEntry(newRouting, true);
|
||||
} finally {
|
||||
indicesService.deleteIndex("test", "simon says");
|
||||
}
|
||||
assertEquals(7, counter.get());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue