@Test
  public void testGetCompletedSnapshotsWithoutCleanup() throws Exception {
    // Disable auto snapshot cleanup for the cluster
    SetSnapshotCleanupRequest setSnapshotCleanupRequest =
      SetSnapshotCleanupRequest.newBuilder().setEnabled(false).build();
    master.getMasterRpcServices().switchSnapshotCleanup(null, setSnapshotCleanupRequest);

    // first check when there are no snapshots
    GetCompletedSnapshotsRequest request = GetCompletedSnapshotsRequest.newBuilder().build();
    GetCompletedSnapshotsResponse response =
      master.getMasterRpcServices().getCompletedSnapshots(null, request);
    assertEquals("Found unexpected number of snapshots", 0, response.getSnapshotsCount());

    // write one snapshot to the fs
    createSnapshotWithTtl("snapshot_02", 1L);
    createSnapshotWithTtl("snapshot_03", 1L);

    // check that we get one snapshot
    response = master.getMasterRpcServices().getCompletedSnapshots(null, request);
    assertEquals("Found unexpected number of snapshots", 2, response.getSnapshotsCount());

    // check that no snapshot is auto cleaned even after 1 sec of TTL expiration
    Uninterruptibles.sleepUninterruptibly(2, TimeUnit.SECONDS);
    response = master.getMasterRpcServices().getCompletedSnapshots(null, request);
    assertEquals("Found unexpected number of snapshots", 2, response.getSnapshotsCount());
  }
Test that the contract from the master for checking on a snapshot are valid.
<p>
<ol>
<li>If a snapshot fails with an error, we expect to get the source error.</li>
<li>If there is no snapshot name supplied, we should get an error.</li>
<li>If asking about a snapshot has hasn't occurred, you should get an error.</li>
</ol>
hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestSnapshotFromMaster.java