[TEST] Delete index in test to release file handles
This commit is contained in:
parent
17110508ac
commit
26b4ebcd00
|
@ -85,10 +85,10 @@ public class FileBasedMappingsTests extends ElasticsearchTestCase {
|
||||||
.put("gateway.type", "none")
|
.put("gateway.type", "none")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Node node = NodeBuilder.nodeBuilder().local(true).data(true).settings(settings).build()) {
|
try (Node node = NodeBuilder.nodeBuilder().local(true).data(true).settings(settings).node()) {
|
||||||
node.start();
|
|
||||||
|
|
||||||
assertAcked(node.client().admin().indices().prepareCreate("index").addMapping("type", "h", "type=string").get());
|
assertAcked(node.client().admin().indices().prepareCreate("index").addMapping("type", "h", "type=string").get());
|
||||||
|
try {
|
||||||
final GetMappingsResponse response = node.client().admin().indices().prepareGetMappings("index").get();
|
final GetMappingsResponse response = node.client().admin().indices().prepareGetMappings("index").get();
|
||||||
assertTrue(response.mappings().toString(), response.mappings().containsKey("index"));
|
assertTrue(response.mappings().toString(), response.mappings().containsKey("index"));
|
||||||
MappingMetaData mappings = response.mappings().get("index").get("type");
|
MappingMetaData mappings = response.mappings().get("index").get("type");
|
||||||
|
@ -96,6 +96,10 @@ public class FileBasedMappingsTests extends ElasticsearchTestCase {
|
||||||
Map<?, ?> properties = (Map<?, ?>) (mappings.getSourceAsMap().get("properties"));
|
Map<?, ?> properties = (Map<?, ?>) (mappings.getSourceAsMap().get("properties"));
|
||||||
assertNotNull(properties);
|
assertNotNull(properties);
|
||||||
assertEquals(ImmutableSet.of("f", "g", "h"), properties.keySet());
|
assertEquals(ImmutableSet.of("f", "g", "h"), properties.keySet());
|
||||||
|
} finally {
|
||||||
|
// remove the index...
|
||||||
|
assertAcked(node.client().admin().indices().prepareDelete("index"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.rm(configDir.toPath());
|
IOUtils.rm(configDir.toPath());
|
||||||
|
|
Loading…
Reference in New Issue