Skip to content

Commit

Permalink
Clean up static web server in sql-client tests (#49187) (#49197)
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 #41526
Relates #49105
  • Loading branch information
jaymode authored Nov 15, 2019
1 parent bc6a9de commit 57f5722
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ public static void init() throws Exception {

@AfterClass
public static void cleanup() {
webServer.close();
webServer = null;
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,8 +59,11 @@ public static void init() throws Exception {

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

public void testBinaryRequestForCLIEnabled() throws URISyntaxException {
Expand Down Expand Up @@ -146,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 57f5722

Please sign in to comment.