Sporadic - but consistent fails

Hi,

I used ElasticSearch to implement a search module for our system, and
now I would like to create some unit tests for it. It seemed to work
in my IDE, but it's sporadically fails in the build environment, and
in the build script, it seems that one or more record is not indexed
properly. I think it's not a timing issue, because I've already added
the 'setRefresh(true)' to the bulk index call, which supposed to be
refresh/rebuild/flush the indexes. Second, if I added a loop, to try
to execute the very same query until it returns the expected number of
records, it never succeeds.
The interesting thing is that not all the records are missing, just a
part of it, for example the tests expects 'id-2','id-4' but it
receives only 'id-4' (So the query is not totally wrong)

Any suggestions, what should I look for ?

This is how the Node is created, not sure it's correct or not :
path = new File(System.getProperty("java.io.tmpdir"), "es-
test-"+Math.random())
settings = ImmutableSettings.settingsBuilder();
settings.put("gateway.type", "none");
nBuilder =
NodeBuilder.nodeBuilder().settings(settings).local(true).data(true);
System.setProperty("es.path.home", path);
// build and start the node
node = nBuilder.node()

BR,
Zsombor

First thing to check is do you get failures when in the bulk response? It would be great if you can gist an easily runnable test that I can run...

On Monday, January 30, 2012 at 8:07 PM, Zsombor wrote:

Hi,

I used Elasticsearch to implement a search module for our system, and
now I would like to create some unit tests for it. It seemed to work
in my IDE, but it's sporadically fails in the build environment, and
in the build script, it seems that one or more record is not indexed
properly. I think it's not a timing issue, because I've already added
the 'setRefresh(true)' to the bulk index call, which supposed to be
refresh/rebuild/flush the indexes. Second, if I added a loop, to try
to execute the very same query until it returns the expected number of
records, it never succeeds.
The interesting thing is that not all the records are missing, just a
part of it, for example the tests expects 'id-2','id-4' but it
receives only 'id-4' (So the query is not totally wrong)

Any suggestions, what should I look for ?

This is how the Node is created, not sure it's correct or not :
path = new File(System.getProperty("java.io.tmpdir"), "es-
test-"+Math.random())
settings = ImmutableSettings.settingsBuilder();
settings.put("gateway.type", "none");
nBuilder =
NodeBuilder.nodeBuilder().settings(settings).local(true).data(true);
System.setProperty("es.path.home", path);
// build and start the node
node = nBuilder.node()

BR,
Zsombor