quarkiverse / quarkus-langchain4j

Quarkus Langchain4j extension
https://docs.quarkiverse.io/quarkus-langchain4j/dev/index.html
Apache License 2.0
149 stars 89 forks source link

Tests failing with UnknownHostException: localhost #478

Closed iocanel closed 7 months ago

iocanel commented 7 months ago

Not sure what triggers that on my machine, but I do get:

java.net.UnknownHostException: localhost
        at wiremock.org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
        at wiremock.org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:450)
        at wiremock.org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:162)
        at wiremock.org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:172)
        at wiremock.org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:142)
        at wiremock.org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at wiremock.org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
        at wiremock.org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at wiremock.org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
        at wiremock.org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:123)
        at com.github.tomakehurst.wiremock.client.HttpAdminClient.safelyExecuteRequest(HttpAdminClient.java:539)
        at com.github.tomakehurst.wiremock.client.HttpAdminClient.executeRequest(HttpAdminClient.java:507)
        at com.github.tomakehurst.wiremock.client.HttpAdminClient.executeRequest(HttpAdminClient.java:483)
        at com.github.tomakehurst.wiremock.client.HttpAdminClient.executeRequest(HttpAdminClient.java:465)
        at com.github.tomakehurst.wiremock.client.HttpAdminClient.resetRequests(HttpAdminClient.java:204)
        at com.github.tomakehurst.wiremock.client.WireMock.resetRequests(WireMock.java:400)
        at io.quarkiverse.langchain4j.testing.internal.WiremockAware.resetRequests(WiremockAware.java:69)
        at org.acme.examples.aiservices.ToolsScopeTestBase.setup(ToolsScopeTestBase.java:27)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.test.QuarkusUnitTest.runExtensionMethod(QuarkusUnitTest.java:500)
        at io.quarkus.test.QuarkusUnitTest.interceptBeforeEachMethod(QuarkusUnitTest.java:386)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
geoand commented 7 months ago

Wow.... I've never seen this one...

iocanel commented 7 months ago

The issue seems to be a malformed entry in my /etc/hosts file. More specifically the use of , as a separator between host names for 127.0.0.1. Still, weird as every other piece of software still manages to resolve localhost.

iocanel commented 7 months ago

Maybe wiremock or one of its dependencies is directly parsing that file.

geoand commented 7 months ago

😱