private void MountGSD(string workingDirectory, string enlistmentPath = null) { string mountCommand; if (enlistmentPath != null) { mountCommand = $"mount \"{enlistmentPath}\" {TestConstants.InternalUseOnlyFlag} {GSDHelpers.GetInternalParameter()}"; } else { mountCommand = $"mount {TestConstants.InternalUseOnlyFlag} {GSDHelpers.GetInternalParameter()}"; } ProcessStartInfo startInfo = new ProcessStartInfo(GSDTestConfig.PathToGSD); startInfo.Arguments = mountCommand; startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; startInfo.CreateNoWindow = true; startInfo.WorkingDirectory = workingDirectory; ProcessResult result = ProcessHelper.Run(startInfo); result.ExitCode.ShouldEqual(0, result.Errors); this.RepoStatusShouldBeMounted(workingDirectory, enlistmentPath); }
private void MountShouldFail(int expectedExitCode, string expectedErrorMessage, string mountWorkingDirectory = null) { string enlistmentRoot = this.Enlistment.EnlistmentRoot; // TODO: 865304 Use app.config instead of --internal* arguments ProcessStartInfo processInfo = new ProcessStartInfo(GSDTestConfig.PathToGSD); processInfo.Arguments = "mount " + TestConstants.InternalUseOnlyFlag + " " + GSDHelpers.GetInternalParameter(); processInfo.WindowStyle = ProcessWindowStyle.Hidden; processInfo.WorkingDirectory = string.IsNullOrEmpty(mountWorkingDirectory) ? enlistmentRoot : mountWorkingDirectory; processInfo.UseShellExecute = false; processInfo.RedirectStandardOutput = true; ProcessResult result = ProcessHelper.Run(processInfo); result.ExitCode.ShouldEqual(expectedExitCode, $"mount exit code was not {expectedExitCode}. Output: {result.Output}"); result.Output.ShouldContain(expectedErrorMessage); }
private Process StartUnmount(string extraParams = "") { string enlistmentRoot = this.Enlistment.EnlistmentRoot; // TODO: 865304 Use app.config instead of --internal* arguments ProcessStartInfo processInfo = new ProcessStartInfo(GSDTestConfig.PathToGSD); processInfo.Arguments = "unmount " + extraParams + " " + TestConstants.InternalUseOnlyFlag + " " + GSDHelpers.GetInternalParameter(); processInfo.WindowStyle = ProcessWindowStyle.Hidden; processInfo.WorkingDirectory = enlistmentRoot; processInfo.UseShellExecute = false; Process executingProcess = new Process(); executingProcess.StartInfo = processInfo; executingProcess.Start(); return(executingProcess); }