armitage420 commented on code in PR #5205: URL: https://github.com/apache/hive/pull/5205#discussion_r1623231180
########## service/src/test/org/apache/hive/service/server/TestHS2HttpServer.java: ########## @@ -59,52 +59,28 @@ /** * TestHS2HttpServer -- executes tests of HiveServer2 HTTP Server. */ -public class TestHS2HttpServer { +public class TestHS2HttpServer extends ThriftCLITestUtils { - private static HiveServer2 hiveServer2 = null; private static CLIService client = null; private static SessionManager sm = null; - private static HiveConf hiveConf = null; private static String metastorePasswd = "61ecbc41cdae3e6b32712a06c73606fa"; //random md5 private static Integer webUIPort = null; private static String apiBaseURL = null; @BeforeClass public static void beforeTests() throws Exception { - webUIPort = MetaStoreTestUtils.findFreePortExcepting( + webUIPort = findFreePortExcepting( Integer.valueOf(ConfVars.HIVE_SERVER2_WEBUI_PORT.getDefaultValue())); apiBaseURL = "http://localhost:" + webUIPort + "/api/v1"; - hiveConf = new HiveConf(); hiveConf.set(ConfVars.METASTORE_PWD.varname, metastorePasswd); hiveConf.set(ConfVars.HIVE_SERVER2_WEBUI_PORT.varname, webUIPort.toString()); hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory"); - Exception hs2Exception = null; - boolean hs2Started = false; - for (int tryCount = 0; (tryCount < MetaStoreTestUtils.RETRY_COUNT); tryCount++) { - try { - hiveServer2 = new HiveServer2(); - hiveServer2.init(hiveConf); - hiveServer2.start(); - client = hiveServer2.getCliService(); - Thread.sleep(5000); - hs2Started = true; - break; - } catch (Exception t) { - HiveConf.setIntVar(hiveConf, HiveConf.ConfVars.HIVE_SERVER2_THRIFT_PORT, - MetaStoreTestUtils.findFreePort()); - HiveConf.setIntVar(hiveConf, HiveConf.ConfVars.HIVE_SERVER2_THRIFT_HTTP_PORT, - MetaStoreTestUtils.findFreePort()); - HiveConf.setIntVar(hiveConf, HiveConf.ConfVars.HIVE_SERVER2_WEBUI_PORT, - MetaStoreTestUtils.findFreePort()); - webUIPort = hiveConf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_WEBUI_PORT); - } - } - if (!hs2Started) { - throw (hs2Exception); - } + startHiveServer2WithConf(hiveConf); Review Comment: We are initialising hs2, port, and hiveconf in base class. hs2 is started only in testclasses. Hence it is not started twice -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org