Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.util.Timeout;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opensearch.client.opensearch.OpenSearchClient;
Expand Down Expand Up @@ -139,7 +140,17 @@ public void testClientSocketTimeoutOnMidResponseHang() {
}
}

private void assertInstanceOf(Class<SocketTimeoutException> socketTimeoutExceptionClass, Throwable cause, String s) {}
private void assertInstanceOf(Class<SocketTimeoutException> socketTimeoutExceptionClass, Throwable actualException, String message) {

if (actualException == null) {
Assert.fail(message + " - Expected exception of type " + socketTimeoutExceptionClass.getSimpleName() + ", but got null");
}

Assert.assertTrue(
message + " - Expected " + socketTimeoutExceptionClass.getSimpleName() + " but got " + actualException.getClass().getSimpleName(),
socketTimeoutExceptionClass.isInstance(actualException)
);
}

public static OpenSearchClient createClientWithCustomTimeout(int socketTimeoutMs, String hostName) {

Expand Down
Loading