private void waitUntilExpectedProgress(long expectedProgress, int maxTimeToCheck) throws InterruptedException {
    int sleptSoFar = 0;
    while (expectedProgress != state.index.hardDeleter.getProgress()) {
      sleptSoFar += 5;
      Thread.sleep(5);
      if (sleptSoFar >= maxTimeToCheck) {
        fail("HardDelete failed to catch up in " + maxTimeToCheck + ". Expected " + expectedProgress + ", actual "
            + state.index.hardDeleter.getProgress());
      }
      state.index.hardDeleter.preLogFlush();
      state.index.hardDeleter.postLogFlush();
    }
  }
Sleeps in intervals of 10ms until expected progress is made or {@code maxTimeToCheck} is reached
@param expectedProgress expected progress value
@param maxTimeToCheck max time to check if expected progress is reached
@throws InterruptedException
ambry-store/src/test/java/com/github/ambry/store/IndexTest.java