зеркало из https://github.com/microsoft/Oryx.git
Merged PR 169439: Introduced a common base class for DockerCommandResult & DockerRunCommandProcessResult
This PR might look big, **but most changes are simple property renames**. Related work items: #819400
This commit is contained in:
Родитель
acff7f58f3
Коммит
812d50a057
|
@ -35,7 +35,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
// Help text must be shown
|
||||
Assert.Contains("Generates and runs build scripts for multiple languages.", result.Output);
|
||||
Assert.Contains("Generates and runs build scripts for multiple languages.", result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore11Version, result.Output);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore11Version, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore11Version, result.Output);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore11Version, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore21Version, result.Output);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore21Version, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore21Version, result.Output);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore21Version, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore22Version, result.Output);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore22Version, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore22Version, result.Output);
|
||||
Assert.Contains(".NET Core Version: " + DotNetCoreVersions.DotNetCore22Version, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -294,8 +294,8 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Matches(@"Pre-build script: /opt/dotnet/2.1.\d+", result.Output);
|
||||
Assert.Matches(@"Post-build script: /opt/dotnet/2.1.\d+", result.Output);
|
||||
Assert.Matches(@"Pre-build script: /opt/dotnet/2.1.\d+", result.StdOut);
|
||||
Assert.Matches(@"Post-build script: /opt/dotnet/2.1.\d+", result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Equal(0, result.ExitCode);
|
||||
Assert.Contains("Could not detect the language from repo", result.Error);
|
||||
Assert.Contains("Could not detect the language from repo", result.StdErr);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -569,10 +569,10 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Matches(@"Pre-build script: /opt/nodejs/6.\d+.\d+/bin/node", result.Output);
|
||||
Assert.Matches(@"Pre-build script: /opt/nodejs/6.\d+.\d+/bin/npm", result.Output);
|
||||
Assert.Matches(@"Post-build script: /opt/nodejs/6.\d+.\d+/bin/node", result.Output);
|
||||
Assert.Matches(@"Post-build script: /opt/nodejs/6.\d+.\d+/bin/npm", result.Output);
|
||||
Assert.Matches(@"Pre-build script: /opt/nodejs/6.\d+.\d+/bin/node", result.StdOut);
|
||||
Assert.Matches(@"Pre-build script: /opt/nodejs/6.\d+.\d+/bin/npm", result.StdOut);
|
||||
Assert.Matches(@"Post-build script: /opt/nodejs/6.\d+.\d+/bin/node", result.StdOut);
|
||||
Assert.Matches(@"Post-build script: /opt/nodejs/6.\d+.\d+/bin/npm", result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(
|
||||
$"Python Version: /opt/python/{PythonVersions.Python37Version}/bin/python3",
|
||||
result.Output);
|
||||
result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.False(result.IsSuccess);
|
||||
Assert.Contains("Missing parentheses in call to 'print'", result.Output);
|
||||
Assert.Contains("Missing parentheses in call to 'print'", result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(
|
||||
$"Python Version: /opt/python/{Settings.Python36Version}/bin/python3",
|
||||
result.Output);
|
||||
result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
"The 'python' version '4.0.1' is not supported. Supported versions are: " +
|
||||
$"{Settings.Python27Version}, {Settings.Python35Version}, {Settings.Python36Version}, {PythonVersions.Python37Version}";
|
||||
Assert.False(result.IsSuccess);
|
||||
Assert.Contains(errorMessage, result.Error);
|
||||
Assert.Contains(errorMessage, result.StdErr);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(
|
||||
$"Python Version: /opt/python/{PythonVersions.Python37Version}/bin/python3",
|
||||
result.Output);
|
||||
result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(
|
||||
$"Python Version: /opt/python/{PythonVersions.Python37Version}/bin/python3",
|
||||
result.Output);
|
||||
result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -705,10 +705,10 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(
|
||||
"Executing the pre-build script from a standalone script!",
|
||||
result.Output);
|
||||
result.StdOut);
|
||||
Assert.Contains(
|
||||
"Executing the post-build script from a standalone script!",
|
||||
result.Output);
|
||||
result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -774,10 +774,10 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(
|
||||
"Executing the pre-build script from a standalone script!",
|
||||
result.Output);
|
||||
result.StdOut);
|
||||
Assert.Contains(
|
||||
"Executing the post-build script from a standalone script!",
|
||||
result.Output);
|
||||
result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -855,10 +855,10 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(
|
||||
$"From pre-build script: {values}",
|
||||
result.Output);
|
||||
result.StdOut);
|
||||
Assert.Contains(
|
||||
$"From post-build script: {values}",
|
||||
result.Output);
|
||||
result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains("'collectstatic' exited with exit code 1.", result.Output);
|
||||
Assert.Contains("'collectstatic' exited with exit code 1.", result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -959,10 +959,10 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Matches(@"Pre-build script: /opt/python/" + version + @".\d+.\d+/bin/python" + version, result.Output);
|
||||
Assert.Matches(@"Pre-build script: /opt/python/" + version + @".\d+.\d+/bin/pip", result.Output);
|
||||
Assert.Matches(@"Post-build script: /opt/python/" + version + @".\d+.\d+/bin/python" + version, result.Output);
|
||||
Assert.Matches(@"Post-build script: /opt/python/" + version + @".\d+.\d+/bin/pip", result.Output);
|
||||
Assert.Matches(@"Pre-build script: /opt/python/" + version + @".\d+.\d+/bin/python" + version, result.StdOut);
|
||||
Assert.Matches(@"Pre-build script: /opt/python/" + version + @".\d+.\d+/bin/pip", result.StdOut);
|
||||
Assert.Matches(@"Post-build script: /opt/python/" + version + @".\d+.\d+/bin/python" + version, result.StdOut);
|
||||
Assert.Matches(@"Post-build script: /opt/python/" + version + @".\d+.\d+/bin/pip", result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
commandToExecuteOnRun: "oryx",
|
||||
commandArguments: new[] { "--version" });
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
commandArguments: new[] { "--version" });
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
});
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
commandArguments: new[] { "--version" });
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
commandArguments: new[] { "--version" });
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Error.ReplaceNewLine();
|
||||
var actualOutput = result.StdErr.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
commandArguments: new[] { "--version" });
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -236,7 +236,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
});
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -273,7 +273,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
|
||||
// Assert
|
||||
// NOTE: Python2 version writes out information to StdErr unlike Python3 versions
|
||||
var actualOutput = result.Error.ReplaceNewLine();
|
||||
var actualOutput = result.StdErr.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -309,7 +309,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
});
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Error.ReplaceNewLine();
|
||||
var actualOutput = result.StdErr.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -350,7 +350,7 @@ namespace Microsoft.Oryx.BuildImage.Tests
|
|||
});
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
|
|
@ -43,10 +43,10 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.False(result.IsSuccess);
|
||||
Assert.NotNull(result.Error);
|
||||
Assert.DoesNotContain(".unspecified, Commit: unspecified", result.Error);
|
||||
Assert.Contains(gitCommitID, result.Error);
|
||||
Assert.Contains(expectedOryxVersion, result.Error);
|
||||
Assert.NotNull(result.StdErr);
|
||||
Assert.DoesNotContain(".unspecified, Commit: unspecified", result.StdErr);
|
||||
Assert.Contains(gitCommitID, result.StdErr);
|
||||
Assert.Contains(expectedOryxVersion, result.StdErr);
|
||||
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
|
@ -64,7 +64,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
commandArguments: new[] { "--version" });
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
commandArguments: new[] { "--info" });
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
|
|
@ -70,8 +70,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(expectedWorkingDir, result.Output);
|
||||
Assert.Contains(expectedStartupCommand, result.Output);
|
||||
Assert.Contains(expectedWorkingDir, result.StdOut);
|
||||
Assert.Contains(expectedStartupCommand, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -109,8 +109,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(expectedWorkingDir, result.Output);
|
||||
Assert.Contains(expectedStartupCommand, result.Output);
|
||||
Assert.Contains(expectedWorkingDir, result.StdOut);
|
||||
Assert.Contains(expectedStartupCommand, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -148,8 +148,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(expectedWorkingDir, result.Output);
|
||||
Assert.Contains(expectedStartupCommand, result.Output);
|
||||
Assert.Contains(expectedWorkingDir, result.StdOut);
|
||||
Assert.Contains(expectedStartupCommand, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -187,8 +187,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(expectedWorkingDir, result.Output);
|
||||
Assert.Contains(expectedStartupCommand, result.Output);
|
||||
Assert.Contains(expectedWorkingDir, result.StdOut);
|
||||
Assert.Contains(expectedStartupCommand, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(expectedStartupCommand, result.Output);
|
||||
Assert.Contains(expectedStartupCommand, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(expectedStartupCommand, result.Output);
|
||||
Assert.Contains(expectedStartupCommand, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -299,8 +299,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(expectedWorkingDir, result.Output);
|
||||
Assert.Contains(expectedStartupCommand, result.Output);
|
||||
Assert.Contains(expectedWorkingDir, result.StdOut);
|
||||
Assert.Contains(expectedStartupCommand, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -400,8 +400,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(expectedWorkingDir, result.Output);
|
||||
Assert.Contains(expectedStartupCommand, result.Output);
|
||||
Assert.Contains(expectedWorkingDir, result.StdOut);
|
||||
Assert.Contains(expectedStartupCommand, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -440,8 +440,8 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(expectedWorkingDir, result.Output);
|
||||
Assert.Contains(expectedStartupCommand, result.Output);
|
||||
Assert.Contains(expectedWorkingDir, result.StdOut);
|
||||
Assert.Contains(expectedStartupCommand, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Contains(expectedStartupCommand, result.Output);
|
||||
Assert.Contains(expectedStartupCommand, result.StdOut);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
|
|
@ -58,10 +58,10 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.False(result.IsSuccess);
|
||||
Assert.NotNull(result.Error);
|
||||
Assert.DoesNotContain(".unspecified, Commit: unspecified", result.Error);
|
||||
Assert.Contains(gitCommitID, result.Error);
|
||||
Assert.Contains(expectedOryxVersion, result.Error);
|
||||
Assert.NotNull(result.StdErr);
|
||||
Assert.DoesNotContain(".unspecified, Commit: unspecified", result.StdErr);
|
||||
Assert.Contains(gitCommitID, result.StdErr);
|
||||
Assert.Contains(expectedOryxVersion, result.StdErr);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
commandArguments: new[] { "--version" });
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
|
|
@ -41,10 +41,10 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
() =>
|
||||
{
|
||||
Assert.False(result.IsSuccess);
|
||||
Assert.NotNull(result.Error);
|
||||
Assert.DoesNotContain(".unspecified, Commit: unspecified", result.Error);
|
||||
Assert.Contains(gitCommitID, result.Error);
|
||||
Assert.Contains(expectedOryxVersion, result.Error);
|
||||
Assert.NotNull(result.StdErr);
|
||||
Assert.DoesNotContain(".unspecified, Commit: unspecified", result.StdErr);
|
||||
Assert.Contains(gitCommitID, result.StdErr);
|
||||
Assert.Contains(expectedOryxVersion, result.StdErr);
|
||||
},
|
||||
result.GetDebugInfo());
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
commandArguments: new[] { "--version" });
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Output.ReplaceNewLine();
|
||||
var actualOutput = result.StdOut.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
|
|||
commandArguments: new[] { "--version" });
|
||||
|
||||
// Assert
|
||||
var actualOutput = result.Error.ReplaceNewLine();
|
||||
var actualOutput = result.StdErr.ReplaceNewLine();
|
||||
RunAsserts(
|
||||
() =>
|
||||
{
|
||||
|
|
|
@ -3,37 +3,28 @@
|
|||
// Licensed under the MIT license.
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
using Microsoft.Oryx.Common;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Oryx.Tests.Common
|
||||
{
|
||||
public class DockerCommandResult
|
||||
public class DockerCommandResult : DockerResultBase
|
||||
{
|
||||
public DockerCommandResult(
|
||||
int exitCode,
|
||||
Exception exception,
|
||||
string output,
|
||||
string error,
|
||||
string executedCommand)
|
||||
public DockerCommandResult(int exitCode, Exception exception, string output, string error, string executedCommand)
|
||||
: base(exception, executedCommand)
|
||||
{
|
||||
ExitCode = exitCode;
|
||||
Exception = exception;
|
||||
Output = output;
|
||||
Error = error;
|
||||
|
||||
ExecutedCommand = executedCommand;
|
||||
StdOut = output;
|
||||
StdErr = error;
|
||||
}
|
||||
|
||||
|
||||
public int ExitCode { get; }
|
||||
public override bool HasExited { get => true; }
|
||||
|
||||
public Exception Exception { get; }
|
||||
public override int ExitCode { get; }
|
||||
|
||||
public string Output { get; }
|
||||
public override string StdOut { get; }
|
||||
|
||||
public string Error { get; }
|
||||
public override string StdErr { get; }
|
||||
|
||||
public bool IsSuccess
|
||||
{
|
||||
|
@ -47,33 +38,12 @@ namespace Microsoft.Oryx.Tests.Common
|
|||
}
|
||||
}
|
||||
|
||||
protected string ExecutedCommand { get; }
|
||||
|
||||
public virtual string GetDebugInfo(IDictionary<string, string> extraDefs = null)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Debugging Information:");
|
||||
sb.AppendLine("----------------------");
|
||||
|
||||
var infoFormatter = new DefinitionListFormatter();
|
||||
infoFormatter.AddDefinition("Executed command", ExecutedCommand);
|
||||
infoFormatter.AddDefinition("Exit code", ExitCode.ToString());
|
||||
infoFormatter.AddDefinition("StdOut", Output);
|
||||
infoFormatter.AddDefinition("StdErr", Error);
|
||||
infoFormatter.AddDefinition("Exception.Message:", Exception?.Message);
|
||||
infoFormatter.AddDefinitions(extraDefs);
|
||||
sb.AppendLine(infoFormatter.ToString());
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"ExitCode: {ExitCode}" + Environment.NewLine +
|
||||
$"Exception: {Exception}" + Environment.NewLine +
|
||||
$"StdOut: {Output}" + Environment.NewLine +
|
||||
$"StdErr: {Error}";
|
||||
$"StdOut: {StdOut}" + Environment.NewLine +
|
||||
$"StdErr: {StdErr}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
// --------------------------------------------------------------------------------------------
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
using Microsoft.Oryx.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Oryx.Tests.Common
|
||||
{
|
||||
public abstract class DockerResultBase
|
||||
{
|
||||
public DockerResultBase(Exception exc, string executedCmd)
|
||||
{
|
||||
Exception = exc;
|
||||
ExecutedCommand = executedCmd;
|
||||
}
|
||||
|
||||
public Exception Exception { get; }
|
||||
|
||||
public string ExecutedCommand { get; }
|
||||
|
||||
public abstract bool HasExited { get; }
|
||||
|
||||
public abstract int ExitCode { get; }
|
||||
|
||||
public abstract string StdOut { get; }
|
||||
|
||||
public abstract string StdErr { get; }
|
||||
|
||||
public virtual string GetDebugInfo(IDictionary<string, string> extraDefs = null)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Debugging Information:");
|
||||
sb.AppendLine("----------------------");
|
||||
|
||||
var infoFormatter = new DefinitionListFormatter();
|
||||
|
||||
infoFormatter.AddDefinition("Executed command", ExecutedCommand);
|
||||
if (HasExited) infoFormatter.AddDefinition("Exit code", ExitCode.ToString());
|
||||
infoFormatter.AddDefinition("StdOut", StdOut);
|
||||
infoFormatter.AddDefinition("StdErr", StdErr);
|
||||
infoFormatter.AddDefinition("Exception.Message:", Exception?.Message);
|
||||
infoFormatter.AddDefinitions(extraDefs);
|
||||
|
||||
sb.AppendLine(infoFormatter.ToString());
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,48 +9,35 @@ using System.Text;
|
|||
|
||||
namespace Microsoft.Oryx.Tests.Common
|
||||
{
|
||||
public class DockerRunCommandProcessResult
|
||||
public class DockerRunCommandProcessResult : DockerResultBase
|
||||
{
|
||||
private readonly StringBuilder _stdOutBuilder;
|
||||
private readonly StringBuilder _stdErrBuilder;
|
||||
|
||||
public DockerRunCommandProcessResult(
|
||||
string containerName,
|
||||
Process process,
|
||||
Exception exception,
|
||||
StringBuilder stdOutput,
|
||||
StringBuilder stdError,
|
||||
string executedCommand)
|
||||
string executedCommand) : base(exception, executedCommand)
|
||||
{
|
||||
ContainerName = containerName;
|
||||
Process = process;
|
||||
Exception = exception;
|
||||
StdOutput = stdOutput;
|
||||
StdError = stdError;
|
||||
ExecutedCommand = executedCommand;
|
||||
_stdOutBuilder = stdOutput;
|
||||
_stdErrBuilder = stdError;
|
||||
}
|
||||
|
||||
public string ContainerName { get; }
|
||||
|
||||
public Process Process { get; }
|
||||
public Exception Exception { get; }
|
||||
public StringBuilder StdOutput { get; }
|
||||
public StringBuilder StdError { get; }
|
||||
public string ExecutedCommand { get; }
|
||||
|
||||
public string GetDebugInfo()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Debugging Information:");
|
||||
sb.AppendLine("----------------------");
|
||||
sb.AppendLine($"Executed command: {ExecutedCommand}");
|
||||
public override bool HasExited { get => Process.HasExited; }
|
||||
|
||||
if (Process.HasExited)
|
||||
{
|
||||
sb.AppendLine($"Exit code: {Process.ExitCode}");
|
||||
}
|
||||
public override int ExitCode { get => Process.ExitCode; }
|
||||
|
||||
sb.AppendLine($"StdOutput: {StdOutput.ToString()}");
|
||||
sb.AppendLine($"StdError: {StdError.ToString()}");
|
||||
sb.AppendLine($"Exception: {Exception?.Message}");
|
||||
return sb.ToString();
|
||||
}
|
||||
public override string StdOut { get => _stdOutBuilder.ToString(); }
|
||||
|
||||
public override string StdErr { get => _stdErrBuilder.ToString(); }
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче