public void DeleteEnlistment()
        {
            TestResultsHelper.OutputGVFSLogs(this);

            // Use cmd.exe to delete the enlistment as it properly handles tombstones
            // and reparse points
            CmdRunner cmdRunner        = new CmdRunner();
            bool      enlistmentExists = Directory.Exists(this.EnlistmentRoot);
            int       retryCount       = 0;

            while (enlistmentExists)
            {
                string output = cmdRunner.DeleteDirectory(this.EnlistmentRoot);
                enlistmentExists = Directory.Exists(this.EnlistmentRoot);
                if (enlistmentExists)
                {
                    ++retryCount;
                    Thread.Sleep(500);
                    try
                    {
                        if (retryCount > 10)
                        {
                            retryCount = 0;
                            throw new DeleteFolderFailedException(output);
                        }
                    }
                    catch (DeleteFolderFailedException)
                    {
                        // Throw\catch a DeleteFolderFailedException here so that developers who are running the tests
                        // and have a debugger attached can be alerted that something is wrong
                    }
                }
            }
        }
Пример #2
0
        protected void TestValidationAndCleanup(bool ignoreCase = false)
        {
            try
            {
                if (TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed)
                {
                    this.anyTestsFailed = true;
                    if (this.enlistmentPerTest)
                    {
                        TestResultsHelper.OutputGVFSLogs(this.Enlistment);
                    }
                }

                this.CheckHeadCommitTree();
                this.Enlistment.RepoRoot.ShouldBeADirectory(this.FileSystem)
                .WithDeepStructure(this.ControlGitRepo.RootPath, skipEmptyDirectories: true, ignoreCase: ignoreCase);

                this.RunGitCommand("reset --hard -q HEAD");
                this.RunGitCommand("clean -d -f -x");
                this.ValidateGitCommand("checkout " + this.ControlGitRepo.Commitish);

                this.CheckHeadCommitTree();
                this.Enlistment.RepoRoot.ShouldBeADirectory(this.FileSystem)
                .WithDeepStructure(this.ControlGitRepo.RootPath, skipEmptyDirectories: true, ignoreCase: ignoreCase);
            }
            finally
            {
                if (this.enlistmentPerTest)
                {
                    this.DeleteEnlistment();
                }
            }
        }
Пример #3
0
        public void DeleteEnlistment()
        {
            TestResultsHelper.OutputGVFSLogs(this);

            // Use cmd.exe to delete the enlistment as it properly handles tombstones and reparse points
            CmdRunner.DeleteDirectoryWithRetry(this.EnlistmentRoot);
        }
        public virtual void DeleteEnlistment()
        {
            if (this.Enlistment != null)
            {
                if (TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed)
                {
                    TestResultsHelper.OutputGVFSLogs(this.Enlistment);
                }

                this.Enlistment.UnmountAndDeleteAll();
            }
        }
Пример #5
0
        public virtual void TearDownForFixture()
        {
            if (!this.enlistmentPerTest)
            {
                if (this.anyTestsFailed)
                {
                    TestResultsHelper.OutputGVFSLogs(this.Enlistment);
                }

                this.DeleteEnlistment();
            }
        }
Пример #6
0
        public virtual void DeleteEnlistment()
        {
            if (this.Enlistment != null)
            {
                if (this.anyTestsFailed)
                {
                    TestResultsHelper.OutputGVFSLogs(this.Enlistment);
                }

                this.Enlistment.UnmountAndDeleteAll();
            }
        }
Пример #7
0
        public void UnmountAndDeleteEnlistment()
        {
            if (LongRunningSetup.Enlistment != null)
            {
                if (LongRunningSetup.OutputLogsWhenDone)
                {
                    TestResultsHelper.OutputGVFSLogs(LongRunningSetup.Enlistment);
                }

                LongRunningSetup.Enlistment.UnmountAndDeleteAll();
                LongRunningSetup.Enlistment = null;
            }
        }
Пример #8
0
        public void DeleteEnlistment()
        {
            TestResultsHelper.OutputGVFSLogs(this);

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                // Use cmd.exe to delete the enlistment as it properly handles tombstones and reparse points
                CmdRunner.DeleteDirectoryWithRetry(this.EnlistmentRoot);
            }
            else
            {
                // TODO(Mac): BashRunner.DeleteDirectory(this.EnlistmentRoot);
            }
        }
        public void DeleteEnlistment()
        {
            TestResultsHelper.OutputGVFSLogs(this);

            // TODO(Mac): Figure out why the call to DeleteDirectoryWithRetry is not returning.
            // Once this is resolved, we can replace this duplicated code with RepositoryHelpers.DeleteTestDirectory
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                // Use cmd.exe to delete the enlistment as it properly handles tombstones and reparse points
                CmdRunner.DeleteDirectoryWithUnlimitedRetries(this.EnlistmentRoot);
            }
            else
            {
                // BashRunner.DeleteDirectoryWithUnlimitedRetries(this.EnlistmentRoot);
            }
        }
Пример #10
0
        private static GVFSFunctionalTestEnlistment CloneAndMount(string pathToGvfs, string enlistmentRoot, string commitish)
        {
            GVFSFunctionalTestEnlistment enlistment = new GVFSFunctionalTestEnlistment(
                pathToGvfs,
                enlistmentRoot ?? GetUniqueEnlistmentRoot(),
                Properties.Settings.Default.RepoToClone,
                commitish ?? Properties.Settings.Default.Commitish);

            try
            {
                enlistment.CloneAndMount();
            }
            catch (Exception e)
            {
                Console.WriteLine("Unhandled exception in CloneAndMount: " + e.ToString());
                TestResultsHelper.OutputGVFSLogs(enlistment);
                throw;
            }

            return(enlistment);
        }
Пример #11
0
        public static GVFSFunctionalTestEnlistment CloneAndMount(string pathToGvfs, string commitish = null)
        {
            GVFSFunctionalTestEnlistment enlistment = new GVFSFunctionalTestEnlistment(
                pathToGvfs,
                Properties.Settings.Default.EnlistmentRoot,
                Properties.Settings.Default.RepoToClone,
                commitish == null ? Properties.Settings.Default.Commitish : commitish);

            try
            {
                enlistment.UnmountAndDeleteAll();
                enlistment.CloneAndMount();
            }
            catch (Exception e)
            {
                Console.WriteLine("Unhandled exception in CloneAndMount: " + e.ToString());
                TestResultsHelper.OutputGVFSLogs(enlistment);
                throw;
            }

            return(enlistment);
        }
Пример #12
0
 public void DeleteEnlistment()
 {
     TestResultsHelper.OutputGVFSLogs(this);
     RepositoryHelpers.DeleteTestDirectory(this.EnlistmentRoot);
 }