public void CreatePackage(DevEnv type, out string standardOutput, out string standardError) { VerifyCloudServiceProjectComponents(); CsPack packageTool = new CsPack(); packageTool.CreatePackage(Components.Definition, Paths.RootPath, type, out standardOutput, out standardError); }
public void CreatePackage(DevEnv type) { string standardOutput, standardError; VerifyCloudServiceProjectComponents(); CsPack packageTool = new CsPack(); packageTool.CreatePackage(Components.Definition, Paths, type, AzureTool.GetAzureSdkBinDirectory(), out standardOutput, out standardError); }
public void CreatePackage(DevEnv type) { string standardOutput, standardError; VerifyCloudServiceProjectComponents(); CsPack packageTool = new CsPack(); packageTool.CreatePackage(Components.Definition, Paths, type, AzureTool.GetAzureSdkBinDirectory(), out standardOutput, out standardError); if (!string.IsNullOrWhiteSpace(standardError)) { //The error of invalid xpath expression about endpoint in the configuration file is expected. Hence, we do not throw. if (!standardError.Contains("/RoleEnvironment/CurrentInstance/Endpoints/Endpoint[@name='HttpIn']/@port")) { throw new InvalidOperationException(string.Format(Properties.Resources.FailedToCreatePackage, standardError)); } } }
void RetrieveRightErrorFromCsPackProcess() { string serviceName = "AzureService"; string sampleError = "error"; string stagingFolder = FileSystemHelper.GetTemporaryDirectoryName(); string fakedSDKBinPath = @"c:\foobar"; Directory.CreateDirectory(stagingFolder); try { CloudServiceProject service = new CloudServiceProject(stagingFolder, serviceName, null); service.AddWorkerRole(Test.Utilities.Common.Data.NodeWorkerRoleScaffoldingPath); CsPack packTool = new CsPack(); string standardOutput, standardError; //Scenario #1 we set up so cspack.exe fails (exitcode is 1), but gives out the error through standardOutput. Mock <ProcessHelper> commandRunner = new Mock <ProcessHelper>(); commandRunner.Setup(p => p.StartAndWaitForProcess(It.IsAny <string>(), It.IsAny <string>())) .Callback(() => { commandRunner.Object.StandardOutput = sampleError; commandRunner.Object.StandardError = ""; commandRunner.Object.ExitCode = 1; }); packTool.ProcessUtil = commandRunner.Object; //action packTool.CreatePackage(service.Components.Definition, service.Paths, DevEnv.Local, fakedSDKBinPath, out standardOutput, out standardError); //assert we take "standardoutput" as the error message Assert.Equal(sampleError, standardError); //Scenario #2: set up so cspack.exe succeed (exitcode is 0) commandRunner = new Mock <ProcessHelper>(); commandRunner.Setup(p => p.StartAndWaitForProcess(It.IsAny <string>(), It.IsAny <string>())) .Callback(() => { commandRunner.Object.StandardOutput = sampleError; commandRunner.Object.StandardError = string.Empty; commandRunner.Object.ExitCode = 0; }); packTool.ProcessUtil = commandRunner.Object; //action packTool.CreatePackage(service.Components.Definition, service.Paths, DevEnv.Local, fakedSDKBinPath, out standardOutput, out standardError); //assert, we outputs no error Assert.Equal(string.Empty, standardError); //Sceanrio 3: set up so cspack.exe failed (exitcode is 1), but gives out no ouput and error commandRunner = new Mock <ProcessHelper>(); commandRunner.Setup(p => p.StartAndWaitForProcess(It.IsAny <string>(), It.IsAny <string>())) .Callback(() => { commandRunner.Object.StandardOutput = string.Empty; commandRunner.Object.StandardError = string.Empty; commandRunner.Object.ExitCode = 1; }); packTool.ProcessUtil = commandRunner.Object; //action packTool.CreatePackage(service.Components.Definition, service.Paths, DevEnv.Local, fakedSDKBinPath, out standardOutput, out standardError); //assert, we output a generic error message Assert.Equal(Resources.CsPackExeGenericFailure, standardError); } finally { Directory.Delete(stagingFolder, true); } }
public void CreatePackage(DevEnv type, out string standardOutput, out string standardError) { packageTool.CreatePackage(Components.Definition, Paths.RootPath, type, out standardOutput, out standardError); }
public void CreatePackage(DevEnv type, out string standardOutput, out string standardError) { VerifyCloudServiceProjectComponents(); CsPack packageTool = new CsPack(); packageTool.CreatePackage(Components.Definition, Paths, type, AzureTool.GetAzureSdkBinDirectory(), out standardOutput, out standardError); }
public void CreatePackage(DevEnv type, out string standardOutput, out string standardError) { VerifyCloudServiceProjectComponents(); CsPack packageTool = new CsPack(); packageTool.CreatePackage(Components.Definition, Paths.RootPath, type, out standardOutput, out standardError); }