@Test
public void testFallback() throws Exception {

  // the source/target dir are not snapshottable dir
  Assert.assertFalse(sync());
  // make sure the source path has been updated to the snapshot path
  final Path spath = new Path(source,
      HdfsConstants.DOT_SNAPSHOT_DIR + Path.SEPARATOR + "s2");
  Assert.assertEquals(spath, context.getSourcePaths().get(0));
  // reset source path in options
  context.setSourcePaths(Collections.singletonList(source));
  // the source/target does not have the given snapshots
  dfs.allowSnapshot(source);
  dfs.allowSnapshot(target);
  Assert.assertFalse(sync());
  Assert.assertEquals(spath, context.getSourcePaths().get(0));
  // reset source path in options
  context.setSourcePaths(Collections.singletonList(source));
  dfs.createSnapshot(source, "s1");
  dfs.createSnapshot(source, "s2");
  dfs.createSnapshot(target, "s1");
  Assert.assertTrue(sync());
  // reset source paths in options
  context.setSourcePaths(Collections.singletonList(source));
  // changes have been made in target
  final Path subTarget = new Path(target, "sub");
  dfs.mkdirs(subTarget);
  Assert.assertFalse(sync());
  // make sure the source path has been updated to the snapshot path
  Assert.assertEquals(spath, context.getSourcePaths().get(0));
  // reset source paths in options
  context.setSourcePaths(Collections.singletonList(source));
  dfs.delete(subTarget, true);
  Assert.assertTrue(sync());
}