Skip to content

Commit

Permalink
Clean up static web server in sql-client tests
Browse files Browse the repository at this point in the history
The JdbcHttpClientRequestTests and HttpClientRequestTests classes both
hold a static reference to a mock web server that internally uses the
JDKs built-in HttpServer, which resides in a sun package that the
RamUsageEstimator does not have access to. This causes builds that use
a runtime of Java 8 to fail since the StaticFieldsInvariantRule is run
when Java 8 is used.

Relates elastic#41526
Relates elastic#49105
  • Loading branch information
jaymode committed Nov 15, 2019
1 parent d8a12a7 commit e9e8a48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ public static void init() throws Exception {

@AfterClass
public static void cleanup() {
webServer.close();
try {
webServer.close();
} finally {
webServer = null;
}
}

public void testBinaryRequestEnabled() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ public static void init() throws Exception {

@AfterClass
public static void cleanup() {
webServer.close();
try {
webServer.close();
} finally {
webServer = null;
}
}

public void testBinaryRequestForCLIEnabled() throws URISyntaxException {
Expand Down Expand Up @@ -145,7 +149,7 @@ private void assertBinaryRequestForDrivers(boolean isBinary, XContentType xConte
HttpClient httpClient = new HttpClient(conCfg);

Mode mode = randomFrom(Mode.JDBC, Mode.ODBC);
SqlQueryRequest request = new SqlQueryRequest(query,
SqlQueryRequest request = new SqlQueryRequest(query,
null,
ZoneId.of("Z"),
randomIntBetween(1, 100),
Expand Down

0 comments on commit e9e8a48

Please sign in to comment.