I am in the process of moving our applications search functionality from Elasticsearch 1.x to 7.x, and from the TransportClient to the HighLevelRestClient, while trying to avoid using all the deprecated (or known to become deprecated or removed in 8) functionality.
Adding actual tests (unit or integration) would be a huge improvement.
There is a ESHighLevelRestTestCase, but it does not appear to actually be packaged and shipped.
Given that the foundation of your testing is being deleted in version 8, what is the timeline for migrating all of it to the Rest Clients?
Is there any infrastructure provided for testing application code that is using the HighLevelRestClient? Given the above sited documentation, I was really hoping that there was, but I haven't been able to find it outside of github, if I missed something I would love pointers.
To run integration tests (not unit tests) you would probably prefer running that in something close to a production environment, like a real elasticsearch server instance. I shared some ideas about integration testing in this thread: In memory testing with RestHighLevelClient
Also this sample project shows how to use Elasticsearch Test Classes:
David, thank you for you reply. Had found all that information already and since most of it is over 2 years old, it may predate the announcement of the demise of the TransportClient, which is what led me to my question:
With Elasticsearch 8, the TransportClient is being deleted. All of the provided Java unit testing infrastructure appears (from documentation and reading the code) to be based entirely on the TransportClient. While there is a ESHighLevelRestTestCase in github, it is not packaged for use by 3rd party developers (ie, me).
Given all that, is there any publicly available testing infrastructure for Elasticsearch that is based on the Java Rest Clients? Or do I just need to roll my own?
Since we are migrating all of our elasticsearch code to the Java Rest Clients, it makes absolutely no sense to base our testing infrastructure on code that is highly dependent on the (soon to be deleted) TransportClient unless there is a clearly stated roadmap from the elasticsearch dev's on how and when that testing infrastructure is going to be migrated.
I'd never rely on the elasticsearch test framework unless I'm building a plugin for elasticsearch. And I think this framework is mainly to test elasticsearch not to test an application calling elasticsearch. But I might be wrong.
And @rjernst can tell more probably.
That's why I prefer starting always my own clusters when it comes to integration tests.
I suspect that you are right that the testing framework is intended just for elasticsearch development (including plugins) and not for 3rd party developers.
That its documented (somewhat extensively) in the released documentation under "Testing" may be more misleading than helpful for developers who are not contributors.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.