lundi 10 avril 2017

Elasticsearch and Testcontainers for testing

I try to write test using elasticsearch container. I run it with http://ift.tt/2lmg4vp library. That's my config:

@ClassRule
public static GenericContainer elasticContainer =
        new GenericContainer("http://ift.tt/2ozExTa")
                .withExposedPorts(9300, 9200)
                .withEnv("xpack.security.enabled", "false")
                .withEnv("transport.host", "127.0.0.1")
                .withEnv("http.host", "0.0.0.0");

And I got an exception:

org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{9fuJUZYWS6O6IgLGOgJDaA}{localhost}{127.0.0.1:32792}]

I reconfigured my ports for test and 9200 port is available (on the port that mapped by testcontainers) - I checked it by curl. But 9300 is not.

Dose anybody knows how to fix transport host problem?

Aucun commentaire:

Enregistrer un commentaire