@Test
  public void testReady() throws Exception {
    String dbName = "default";
    String tblName = "trfcp";
    String partName = "ds=today";
    Table t = newTable(dbName, tblName, true);
    Partition p = newPartition(t, "today");

    // minor compaction
    addBaseFile(t, p, 19L, 19);
    addDeltaFile(t, p, 20L, 20L, 1);
    addDeltaFile(t, p, 21L, 21L, 1);
    addDeltaFile(t, p, 22L, 22L, 1);
    burnThroughTransactions(dbName, tblName, 22);

    // block cleaner with an open txn
    long txnId = openTxn();
    if (useMinHistoryWriteId()) {
      allocateTableWriteId(dbName, tblName, txnId);
    }
    CompactionRequest rqst = new CompactionRequest(dbName, tblName, CompactionType.MINOR);
    rqst.setPartitionname(partName);
    long ctxnid = compactInTxn(rqst);
    addDeltaFile(t, p, 20, 22, 2, ctxnid);
    startCleaner();

    // make sure cleaner didn't remove anything, and cleaning is still queued
    List<Path> paths = getDirectories(conf, t, p);
    Assert.assertEquals("Expected 5 files after minor compaction, instead these files were present " + paths, 5,
        paths.size());
    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
    Assert.assertEquals("Expected 1 compaction in queue, got: " + rsp.getCompacts(), 1, rsp.getCompactsSize());
    Assert.assertEquals(TxnStore.CLEANING_RESPONSE, rsp.getCompacts().get(0).getState());
  }
Tests for the compactor Cleaner thread
ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java