public virtual void Setup()
        {
            try
            {
                lfs       = FileContext.GetLocalFSFileContext();
                workDir   = new Path("/tmp/temp-" + Runtime.CurrentTimeMillis());
                workSpace = new FilePath(workDir.ToUri().GetPath());
                lfs.Mkdir(workDir, FsPermission.GetDirDefault(), true);
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
            Configuration conf = new Configuration();

            yarnImage = "yarnImage";
            long time = Runtime.CurrentTimeMillis();

            conf.Set(YarnConfiguration.NmLocalDirs, "/tmp/nm-local-dir" + time);
            conf.Set(YarnConfiguration.NmLogDirs, "/tmp/userlogs" + time);
            dockerUrl = Runtime.GetProperty("docker-service-url");
            Log.Info("dockerUrl: " + dockerUrl);
            if (Strings.IsNullOrEmpty(dockerUrl))
            {
                return;
            }
            dockerUrl  = " -H " + dockerUrl;
            dockerExec = "docker " + dockerUrl;
            conf.Set(YarnConfiguration.NmDockerContainerExecutorImageName, yarnImage);
            conf.Set(YarnConfiguration.NmDockerContainerExecutorExecName, dockerExec);
            exec        = new DockerContainerExecutor();
            dirsHandler = new LocalDirsHandlerService();
            dirsHandler.Init(conf);
            exec.SetConf(conf);
            appSubmitter = Runtime.GetProperty("application.submitter");
            if (appSubmitter == null || appSubmitter.IsEmpty())
            {
                appSubmitter = "nobody";
            }
            ShellExec(dockerExec + " pull " + testImage);
        }
        public virtual void Setup()
        {
            Assume.AssumeTrue(Shell.Linux);
            FilePath f = new FilePath("./src/test/resources/mock-container-executor");

            if (!FileUtil.CanExecute(f))
            {
                FileUtil.SetExecutable(f, true);
            }
            string        executorPath = f.GetAbsolutePath();
            Configuration conf         = new Configuration();

            yarnImage = "yarnImage";
            long time = Runtime.CurrentTimeMillis();

            conf.Set(YarnConfiguration.NmLinuxContainerExecutorPath, executorPath);
            conf.Set(YarnConfiguration.NmLocalDirs, "/tmp/nm-local-dir" + time);
            conf.Set(YarnConfiguration.NmLogDirs, "/tmp/userlogs" + time);
            conf.Set(YarnConfiguration.NmDockerContainerExecutorImageName, yarnImage);
            conf.Set(YarnConfiguration.NmDockerContainerExecutorExecName, DockerLaunchCommand
                     );
            dockerContainerExecutor = new DockerContainerExecutor();
            dirsHandler             = new LocalDirsHandlerService();
            dirsHandler.Init(conf);
            dockerContainerExecutor.SetConf(conf);
            lfs = null;
            try
            {
                lfs     = FileContext.GetLocalFSFileContext();
                workDir = new Path("/tmp/temp-" + Runtime.CurrentTimeMillis());
                lfs.Mkdir(workDir, FsPermission.GetDirDefault(), true);
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }
        }