I am currently trying to implement integration tests in Java for some sample data I have come up with to test a feature I just finished. Everything is going well and I am able to start a node, create the mapping, seed the data and make my assertions. The problem is occurring during the @after in ESIntegTestCase where there are several calls that look something like this: client().admin().cluster().someOtherCall()... which will randomly cause this error:
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{local}{local[5]}]]
at __randomizedtesting.SeedInfo.seed([2C373C1B13097282:742FFB2F7E484278]:0)
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:207)
at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)
Where the '{local[X]}' (5 in this case) in the error changes from run to run.
My java to create the index/mapping/data looks roughly like this:
protected void initializeData() throws JsonParseException, JsonMappingException, IOException {
createIndex(INDEX);
ensureGreen(INDEX);
refresh();
CLIENT = client();
String mappingOne = readFile(MAPPING_RESOURCE);
String mappingTwo = readFile(MAPPING_RESOURCE);
CLIENT.admin().indices()
.putMapping(new PutMappingRequest(INDEX).type(TYPE_1).source(mappingOne))
.actionGet();
CLIENT.admin().indices()
.putMapping(new PutMappingRequest(INDEX).type(TYPE_2).source(mappingTwo)).actionGet();
CLIENT.prepareIndex(INDEX, TYPE_1, getId().toString())
.setSource(my_test_json_data).execute().actionGet();
CLIENT.prepareIndex(INDEX, TYPE_2, getId().toString())
.setSource(my_test_json_data).execute().actionGet();
CLIENT.admin().indices().refresh(new RefreshRequest(INDEX)).actionGet();
}
Has anyone experienced anything like this or have any insight into the error I am seeing?