@Test
  public void testShouldSkipRenameSnapshotDirectories() {
    URI workingDirURI = URI.create("/User/test1");
    URI rootDirURI = URI.create("hdfs:///User/test2");

    // should skip rename if it's not the same scheme;
    assertTrue(
      SnapshotDescriptionUtils.shouldSkipRenameSnapshotDirectories(workingDirURI, rootDirURI));

    workingDirURI = URI.create("/User/test1");
    rootDirURI = URI.create("file:///User/test2");
    assertTrue(
      SnapshotDescriptionUtils.shouldSkipRenameSnapshotDirectories(workingDirURI, rootDirURI));

    // skip rename when either scheme or authority are the not same
    workingDirURI = URI.create("hdfs://localhost:8020/User/test1");
    rootDirURI = URI.create("hdfs://otherhost:8020/User/test2");
    assertTrue(
      SnapshotDescriptionUtils.shouldSkipRenameSnapshotDirectories(workingDirURI, rootDirURI));

    workingDirURI = URI.create("file:///User/test1");
    rootDirURI = URI.create("hdfs://localhost:8020/User/test2");
    assertTrue(
      SnapshotDescriptionUtils.shouldSkipRenameSnapshotDirectories(workingDirURI, rootDirURI));

    workingDirURI = URI.create("hdfs:///User/test1");
    rootDirURI = URI.create("hdfs:///User/test2");
    assertFalse(
      SnapshotDescriptionUtils.shouldSkipRenameSnapshotDirectories(workingDirURI, rootDirURI));

    workingDirURI = URI.create("hdfs://localhost:8020/User/test1");
    rootDirURI = URI.create("hdfs://localhost:8020/User/test2");
    assertFalse(
      SnapshotDescriptionUtils.shouldSkipRenameSnapshotDirectories(workingDirURI, rootDirURI));

    workingDirURI = URI.create("hdfs://user:password@localhost:8020/User/test1");
    rootDirURI = URI.create("hdfs://user:password@localhost:8020/User/test2");
    assertFalse(
      SnapshotDescriptionUtils.shouldSkipRenameSnapshotDirectories(workingDirURI, rootDirURI));

    // skip rename when user information is not the same
    workingDirURI = URI.create("hdfs://user:password@localhost:8020/User/test1");
    rootDirURI = URI.create("hdfs://user2:password2@localhost:8020/User/test2");
    assertTrue(
      SnapshotDescriptionUtils.shouldSkipRenameSnapshotDirectories(workingDirURI, rootDirURI));
  }
Test that we throw an exception if there is no working snapshot directory when we attempt to
'complete' the snapshot
@throws Exception on failure
hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSnapshotDescriptionUtils.java