saurabhd336 commented on code in PR #8828: URL: https://github.com/apache/pinot/pull/8828#discussion_r931842396
########## pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java: ########## @@ -2366,16 +2367,44 @@ public void testJDBCClient() Assert.assertTrue(resultSet.getLong(1) > 0); } - private java.sql.Connection getJDBCConnectionFromController(int controllerPort) throws Exception { + private java.sql.Connection getJDBCConnectionFromController(int controllerPort) + throws Exception { PinotDriver pinotDriver = new PinotDriver(); Properties jdbcProps = new Properties(); return pinotDriver.connect("jdbc:pinot://localhost:" + controllerPort, jdbcProps); } - private java.sql.Connection getJDBCConnectionFromBrokers(int controllerPort, int brokerPort) throws Exception { + private java.sql.Connection getJDBCConnectionFromBrokers(int controllerPort, int brokerPort) + throws Exception { PinotDriver pinotDriver = new PinotDriver(); Properties jdbcProps = new Properties(); jdbcProps.put(PinotConnection.BROKER_LIST, "localhost:" + brokerPort); return pinotDriver.connect("jdbc:pinot://localhost:" + controllerPort, jdbcProps); } + + private void reloadOfflineTableAndValidateResponse(String tableName, boolean forceDownload) { + try { + String response = + sendPostRequest(_controllerRequestURLBuilder.forTableReload(tableName, TableType.OFFLINE, forceDownload), + null); + String tableNameWithType = TableNameBuilder.OFFLINE.tableNameWithType(tableName); + JsonNode tableLevelDetails = + JsonUtils.stringToJsonNode(StringEscapeUtils.unescapeJava(response.split(": ")[1])).get(tableNameWithType); + String isZKWriteSuccess = tableLevelDetails.get("reloadJobMetaZKStorageStatus").asText(); + + if (isZKWriteSuccess.equals("SUCCESS")) { + // We can validate reload status API now + String jobId = tableLevelDetails.get("reloadMessageId").asText(); + String jobStatusResponse = sendGetRequest(_controllerRequestURLBuilder.forControllerJobStatus(jobId)); + JsonNode jobStatus = JsonUtils.stringToJsonNode(jobStatusResponse); + + // Validate all fields are present + assertEquals(jobStatus.get("metadata").get("jobId").asText(), jobId); + assertEquals(jobStatus.get("metadata").get("jobType").asText(), "RELOAD_ALL_SEGMENTS"); + assertEquals(jobStatus.get("metadata").get("tableName").asText(), tableNameWithType); + } + } catch (Exception e) { + Assert.fail("Reload failed :" + e.getMessage()); Review Comment: Ack -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org