How to build an embedded node in 5.x

I've used embedded Nodes for integration testing. Prior to 5.x, I could build a Node using the NodeBuilder. Now that builder is gone. How do I build an embedded node for testing?

Looking at Boostrap.java, I am seeing:

        node = new Node(environment) {
            @Override
            protected void validateNodeBeforeAcceptingRequests(
                final Settings settings,
                final BoundTransportAddress boundTransportAddress) throws NodeValidationException {
                BootstrapCheck.check(settings, boundTransportAddress);
            }
        };

Is this the way?

Running an embedded node isn't supported for anything, testing or otherwise. So you might be able to get it working now but it could fail on any release in the future. I suggest starting Elasticsearch before running integration tests in your build somehow.

Yes. Read this: https://www.elastic.co/blog/elasticsearch-the-server

Here is how I solved that basically using some Maven/Ant vodoo:

You can also extend ESIntegTestCase as I described here: http://david.pilato.fr/blog/2016/07/27/creating-a-plugin-for-elasticsearch-5-dot-0-using-maven/ (see Add test infrastructure).

HTH

Thanks!

You could also consider the embedded node for integration tests:

Hope it helps!