Skip to content

Commit

Permalink
Revert "rollback initHttpServer update, might be flaky"
Browse files Browse the repository at this point in the history
This reverts commit fb25b6e.
  • Loading branch information
py023 committed Feb 27, 2024
1 parent 89f14a4 commit 38aed3a
Showing 1 changed file with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.doris.common.ExceptionChecker.ThrowingRunnable;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.jmockit.Deencapsulation;
import org.apache.doris.common.util.UnitTestUtil;
import org.apache.doris.datasource.CatalogMgr;
import org.apache.doris.datasource.InternalCatalog;
import org.apache.doris.httpv2.HttpServer;
Expand Down Expand Up @@ -74,7 +75,6 @@

import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -326,24 +326,8 @@ private static void assignBackends() {

@BeforeClass
public static void initHttpServer() throws IllegalArgException, InterruptedException {
ServerSocket socket = null;
try {
socket = new ServerSocket(0);
socket.setReuseAddress(true);
HTTP_PORT = socket.getLocalPort();
URI = "http://localhost:" + HTTP_PORT + "/api/" + DB_NAME + "/" + TABLE_NAME;
} catch (Exception e) {
throw new IllegalStateException("Could not find a free TCP/IP port to start HTTP Server on");
} finally {
if (socket != null) {
try {
socket.close();
} catch (Exception e) {
// CHECKSTYLE IGNORE THIS LINE
}
}
}

HTTP_PORT = UnitTestUtil.findValidPort();
URI = "http://localhost:" + HTTP_PORT + "/api/" + DB_NAME + "/" + TABLE_NAME;
FeConstants.runningUnitTest = true;
httpServer = new HttpServer();
httpServer.setPort(HTTP_PORT);
Expand Down

0 comments on commit 38aed3a

Please sign in to comment.