Elasticsearch REST integration test setup

I had noticed that in many other questions people are trying to use Elasticsearch test framework to setup integration tests with REST client (either high or low level).

I had manage to configure it without any external dependecies (maven or gradle elasticsearch plugin). This has it prons and cons, but allows to setup a real test case against a cluster and validate the responses.

You can find a working snippet here: https://gist.github.com/jmnarloch/68ab1ce0535733a65a1b293f7cd99886

Use the class as base for your tests.

You need to add as your project dependencies:

I would be cool though if this would be part of the test framework as well.

Unfortunately using ESIntegTestCase is not a "real" integration test, due to the fact it is creating an in memory cluster (many nodes in the same jvm). That test case is meant for plugin authors and testing internals of Elasticsearch. We recommend testing client usage with a real cluster, which can be done in either maven or gradle.

1 Like

I shared some ideas about integration testing in this thread: In memory testing with RestHighLevelClient

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.