jtao15 commented on a change in pull request #8422: URL: https://github.com/apache/pinot/pull/8422#discussion_r838958405
########## File path: pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java ########## @@ -408,7 +413,41 @@ public void testUploadSegmentRefreshOnly() assertEquals(segmentsZKMetadata.size(), 1); assertNotEquals(segmentsZKMetadata.get(0).getRefreshTime(), Long.MIN_VALUE); } + waitForNumOfSegmentsBecomeOnline(offlineTableName, 1); dropOfflineTable(SEGMENT_UPLOAD_TEST_TABLE); + testTableDataManagerCleanup(offlineTableName); + } + + private void waitForNumOfSegmentsBecomeOnline(String tableNameWithType, int numSegments) + throws InterruptedException, TimeoutException { + long endTimeMs = System.currentTimeMillis() + EXTERNAL_VIEW_ONLINE_SEGMENTS_MAX_WAIT_MS; + do { + Set<String> onlineSegments = _helixResourceManager.getOnlineSegmentsFromExternalView(tableNameWithType); + if (onlineSegments.size() == numSegments) { + return; + } + Thread.sleep(EXTERNAL_VIEW_CHECK_INTERVAL_MS); + } while (System.currentTimeMillis() < endTimeMs); + throw new TimeoutException(String + .format("Time out while waiting segments become ONLINE. (tableNameWithType = %s)", tableNameWithType)); + } + + private void testTableDataManagerCleanup(String offlineTableName) Review comment: Good catch, refactored the function and put it in the parent class. -- 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