@Test
  public void testEnableCompactionOnTimerExpiryHandler() throws InterruptedException {
    // Arrange
    reset();

    // Act
    bootstrapSessionManagerWithCompactionHandler.addAndStartBootstrapSession(mockPartitionId, "snapshot4", "nodeZ");

    // Wait for time with buffer (50% extra time considering the default timer in test context is configured to be 300ms.
    // Less than 50% buffer could end up making this test flaky due to GC or other jvm delays)
    long waitTimeMs = (long) (diskManagerDeferredCompactionDefaultTimerTimeoutMilliseconds * 1.5);
    Thread.sleep(waitTimeMs);

    assertTrue("Compaction should be re-enabled after deferral timer expiry", compactionEnabled.get());
    assertNull("Bootstrap session should be cleaned up after timer expiry",
        bootstrapSessionManagerWithCompactionHandler.getBootstrapSession(mockPartitionId, "nodeZ"));
  }
Test that controlCompactionForBlobStore handler passed to BootstrapSessionManager is called when the default timer
expires. The session should be cleaned up after the timer expires.
ambry-store/src/test/java/com/github/ambry/store/BootstrapSessionManagerTest.java