Skip to content

Commit 045f76d

Browse files
committed
LLClient: Fix assertion on windows
In windows the exception message is ever so slightly differant than in Linux and OSX. That is fine. We'll just catch either.
1 parent a0d6c19 commit 045f76d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

client/rest/src/test/java/org/elasticsearch/client/RestClientMultipleHostsIntegTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
import static org.elasticsearch.client.RestClientTestUtil.getAllStatusCodes;
4343
import static org.elasticsearch.client.RestClientTestUtil.randomErrorNoRetryStatusCode;
4444
import static org.elasticsearch.client.RestClientTestUtil.randomOkStatusCode;
45+
import static org.hamcrest.Matchers.startsWith;
4546
import static org.junit.Assert.assertEquals;
47+
import static org.junit.Assert.assertThat;
4648
import static org.junit.Assert.assertTrue;
4749
import static org.junit.Assert.fail;
4850

@@ -214,7 +216,8 @@ public void testNodeSelector() throws IOException {
214216
restClient.performRequest(request);
215217
fail("expected to fail to connect");
216218
} catch (ConnectException e) {
217-
assertEquals("Connection refused", e.getMessage());
219+
// This is different in windows and linux but this matches both.
220+
assertThat(e.getMessage(), startsWith("Connection refused"));
218221
}
219222
} else {
220223
Response response = restClient.performRequest(request);

0 commit comments

Comments
 (0)