private void doActionAndVerifyWaitForBackup(Runnable function)
      throws InterruptedException, TimeoutException, ExecutionException {
    DistributionManager dm = cacheRule.getCache().getDistributionManager();
    Set recipients = dm.getOtherDistributionManagerIds();

    Properties backupProperties = new BackupConfigFactory()
        .withTargetDirPath(getDiskDir().toString()).createBackupProperties();

    new PrepareBackupStep(dm, dm.getId(), dm.getCache(), recipients,
        new PrepareBackupFactory(), backupProperties).send();

    ReentrantLock backupLock = ((LocalRegion) region).getDiskStore().getBackupLock();
    Future<Void> future = CompletableFuture.runAsync(function);
    await()
        .untilAsserted(() -> assertThat(backupLock.getQueueLength()).isGreaterThanOrEqualTo(0));

    new FinishBackupStep(dm, dm.getId(), dm.getCache(), recipients, new FinishBackupFactory())
        .send();

    future.get(5, TimeUnit.SECONDS);
  }
Create a region, installing the test hook in the backup lock

@param shortcut The region shortcut to use to create the region
@return The newly created region.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/backup/PrepareAndFinishBackupDistributedTest.java