@Test
  public void testThatCompactionWorksAfterRegionIsClosedAndThenRecovered()
      throws InterruptedException {

    createDiskStore(30, 10000);
    Region<Object, Object> region = createRegion();
    DiskStoreImpl diskStore = ((InternalRegion) region).getDiskStore();

    // Create several oplog files (.crf and .drf) by executing put operations in defined range
    executePutOperations(region);
    await().untilAsserted(() -> assertThat(getCurrentNumberOfOplogs(diskStore)).isEqualTo(5));

    Set<Long> oplogIds = getAllOplogIds(diskStore);

    region.close();
    region = createRegion();

    // Execute destroy operations for all entries created in previous step. All oplogs created
    // in previous step will not contain live entries, so they must be compacted.
    executeDestroyOperations(region);

    await().untilAsserted(
        () -> assertThat(areOplogsCompacted(oplogIds, diskStore)).isTrue());
  }
Verifies that compaction works as expected after region is recovered
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskRegionCompactorClearOplogAfterRecoveryIntegrationTest.java