@Test
  public void testRemoveRemoteWALs() throws Exception {
    String peerId = "2";
    addPeerAndWait(peerId, "hbase", true);
    // make sure that we can deal with files which does not exist
    String walNameNotExists =
      "remoteWAL-12345-" + peerId + ".12345" + ReplicationUtils.SYNC_WAL_SUFFIX;
    Path wal = new Path(logDir, walNameNotExists);
    manager.postLogRoll(wal);

    Path remoteLogDirForPeer = new Path(remoteLogDir, peerId);
    FS.mkdirs(remoteLogDirForPeer);
    String walName = "remoteWAL-12345-" + peerId + ".23456" + ReplicationUtils.SYNC_WAL_SUFFIX;
    Path remoteWAL =
      new Path(remoteLogDirForPeer, walName).makeQualified(FS.getUri(), FS.getWorkingDirectory());
    FS.create(remoteWAL).close();
    wal = new Path(logDir, walName);
    manager.postLogRoll(wal);

    ReplicationSourceInterface source = manager.getSource(peerId);
    manager.cleanOldLogs(walName, true, source);
    assertFalse(FS.exists(remoteWAL));
  }
Remove a peer and wait for it to get cleaned up
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java