test: ensure the bulk has been opened before trying to export

The LocalExporter tests seem to fail regularly in CI. It appears as though there is a race condition
where the LocalExporter has not truly been started yet and the tests try to send a collected document
through the exporter. The documents being indexed by the test are never indexed and are dropped.
The tests now wait for the exporter to be started.

Relates to elastic/elasticsearch#847

Original commit: elastic/x-pack-elasticsearch@b391067cae
This commit is contained in:
jaymode 2015-10-22 15:05:51 -04:00
parent 203e6f4c6e
commit b9b914408e
1 changed files with 6 additions and 0 deletions

View File

@ -288,6 +288,12 @@ public class LocalExporterTests extends MarvelIntegTestCase {
final Exporter exporter = internalCluster().getInstance(Exporters.class).getExporter(name);
assertThat(exporter, notNullValue());
assertThat(exporter, instanceOf(LocalExporter.class));
assertBusy(new Runnable() {
@Override
public void run() {
assertThat(exporter.openBulk(), notNullValue());
}
});
return (LocalExporter) exporter;
}