Elasticsearch is not connected when I run ./gradlew test

Hi Guys,
I want to test a test case, but there’s a problem—Elasticsearch isn’t connecting.
Note:Only When I run ./gradlew test, it doesn’t connect, but when I run ./gradlew load, Elasticsearch connects successfully.

   12:18:57.011  WARN  Test worker               o.eclipse.j.u.s.S.config No Client EndPointIdentificationAlgorithm configured for Client@4ad04b05[provider=null,keyStore=null,trustStore=null]
    12:18:57.055 ERROR  Test worker          o.moqui.i.c.ElasticFacadeImpl Error initializing ElasticClient for cluster default: java.util.concurrent.ExecutionException: java.net.ConnectException: Connection refused
    12:18:57.055  WARN  Test worker          o.moqui.i.c.ElasticFacadeImpl No Elastic Client found with name 'logger' or 'default', not initializing ElasticSearchLogger

what is the issue and how to fix it?

Without loading, you don’t really have elastic search data being populated. Best thing is to read build.gradle and understand the task dependencies and what calls what. Eventually you’ll reach the logic for downloading and starting elastic.

1 Like