How to build an embedded node in 5.x


(Dminkovsky) #1

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?


(Nik Everett) #2

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.


(David Pilato) #3

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


(Dminkovsky) #4

Thanks!


(Przemek) #5

You could also consider the embedded node for integration tests:

Hope it helps!