Callable<Path> download(Path destDirPath, LocalResource rsrc,
      UserGroupInformation ugi) throws IOException {
    // For private localization FsDownload creates folder in destDirPath. Parent
    // directories till user filecache folder is created here.
    if (rsrc.getVisibility() == LocalResourceVisibility.PRIVATE) {
      createParentDirs(destDirPath);
    }
    diskValidator
        .checkStatus(new File(destDirPath.getParent().toUri().getRawPath()));
    return new FSDownloadWrapper(lfs, ugi, conf, destDirPath, rsrc);
  }
@Test
  public void testDiskCheckFailure() throws Exception {
    Configuration conf = new Configuration();
    conf.set(YarnConfiguration.DISK_VALIDATOR, "read-write");
    FileContext lfs = FileContext.getLocalFSFileContext(conf);
    Path fileCacheDir = lfs.makeQualified(new Path(basedir, "filecache"));
    lfs.mkdir(fileCacheDir, FsPermission.getDefault(), true);
    RecordFactory recordFactory = mock(RecordFactory.class);
    ContainerLocalizer localizer = new ContainerLocalizer(lfs,
        UserGroupInformation.getCurrentUser().getUserName(), "application_01",
        "container_01", String.format(ContainerExecutor.TOKEN_FILE_NAME_FMT,
        "container_01"), new ArrayList<>(), recordFactory){
      @Override
      Configuration initConfiguration() {
        return conf;
      }
    };
    LocalResource rsrc = mock(LocalResource.class);
    Path destDirPath = new Path(fileCacheDir, "11");
    try {
      localizer.download(destDirPath, rsrc,
          UserGroupInformation.getCurrentUser());
    } catch (DiskErrorException ex) {
      fail(ex.getCause().toString());
    }
  }