Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy committed Aug 7, 2024
1 parent 68f82cb commit 7186a71
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/test/java/net/snowflake/client/core/HttpUtilLatestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@
import org.apache.http.impl.client.CloseableHttpClient;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category(TestCategoryCore.class)
public class HttpUtilLatestIT {

private static final String HANG_WEBSERVER_ADDRESS = "http://localhost:12345/hang";
private static final String HANG_WEBSERVER_ADDRESS = "http://localhost:1234/hang";

/** Added in > 3.14.5 */
@Test
public void shouldGetDefaultConnectionAndSocketTimeouts() {
assertEquals(Duration.ofMillis(60_000), HttpUtil.getConnectionTimeout());
assertEquals(Duration.ofMillis(300_000), HttpUtil.getSocketTimeout());
}

/** Added in > 3.14.5 */
@Test(timeout = 1000L)
Expand All @@ -36,13 +45,10 @@ public void shouldOverrideConnectionAndSocketTimeouts() {
fail("Request should fail with exception");
} catch (IOException e) {
MatcherAssert.assertThat(e, CoreMatchers.instanceOf(SocketTimeoutException.class));
}finally {
HttpUtil.setSocketTimeout(300000);
HttpUtil.setConnectionTimeout(60000);
}
}

/** Added in > 3.14.5 */
@Test
public void shouldGetDefaultConnectionAndSocketTimeouts() {
assertEquals(Duration.ofMillis(60_000), HttpUtil.getConnectionTimeout());
assertEquals(Duration.ofMillis(300_000), HttpUtil.getSocketTimeout());
}
}

0 comments on commit 7186a71

Please sign in to comment.