Revert tests for feature that is about to be reverted by merge
The mode switch tests are failing as they hit the 2.2.1xx branch because we don't have a dotnet/sdk with the needed support for it. Since the feature is reverted in release/2.1.4xx anyway, revert the tests ahead of time to match release/2.1.4xx (modulo s/2.1/2.2/)
This commit is contained in:
parent
423b718bea
commit
02c19ad945
1 changed files with 14 additions and 64 deletions
|
@ -97,15 +97,14 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("self-contained", null)]
|
[InlineData(null)]
|
||||||
[InlineData(null, null)]
|
[InlineData("--self-contained")]
|
||||||
[InlineData(null, "--self-contained")]
|
[InlineData("--self-contained=true")]
|
||||||
[InlineData(null, "--self-contained=true")]
|
public void ItPublishesSelfContainedWithRid(string args)
|
||||||
public void ItPublishesSelfContainedWithRid(string mode, string args)
|
|
||||||
{
|
{
|
||||||
var testAppName = "MSBuildTestApp";
|
var testAppName = "MSBuildTestApp";
|
||||||
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||||
var outputDirectory = PublishApp(testAppName, rid, mode, args);
|
var outputDirectory = PublishApp(testAppName, rid, args);
|
||||||
|
|
||||||
var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}");
|
var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}");
|
||||||
|
|
||||||
|
@ -116,16 +115,14 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("fx-dependent", null)]
|
[InlineData("--self-contained=false")]
|
||||||
[InlineData(null, "--self-contained=false")]
|
public void ItPublishesFrameworkDependentWithRid(string args)
|
||||||
public void ItPublishesFrameworkDependentWithRid(string mode, string args)
|
|
||||||
{
|
{
|
||||||
var testAppName = "MSBuildTestApp";
|
var testAppName = "MSBuildTestApp";
|
||||||
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
||||||
var outputDirectory = PublishApp(testAppName, rid, mode, args);
|
var outputDirectory = PublishApp(testAppName, rid, args);
|
||||||
|
|
||||||
outputDirectory.Should().OnlyHaveFiles(new[] {
|
outputDirectory.Should().OnlyHaveFiles(new[] {
|
||||||
$"{testAppName}{Constants.ExeSuffix}",
|
|
||||||
$"{testAppName}.dll",
|
$"{testAppName}.dll",
|
||||||
$"{testAppName}.pdb",
|
$"{testAppName}.pdb",
|
||||||
$"{testAppName}.deps.json",
|
$"{testAppName}.deps.json",
|
||||||
|
@ -134,31 +131,6 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
|
||||||
|
|
||||||
var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}");
|
var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}");
|
||||||
|
|
||||||
var command = new TestCommand(outputProgram);
|
|
||||||
command.Environment[Environment.Is64BitProcess ? "DOTNET_ROOT" : "DOTNET_ROOT(x86)"] =
|
|
||||||
new RepoDirectoriesProvider().DotnetRoot;
|
|
||||||
|
|
||||||
command.ExecuteWithCapturedOutput()
|
|
||||||
.Should()
|
|
||||||
.Pass()
|
|
||||||
.And
|
|
||||||
.HaveStdOutContaining("Hello World");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void ItPublishesFrameworkDependentNoExeWithRid()
|
|
||||||
{
|
|
||||||
var testAppName = "MSBuildTestApp";
|
|
||||||
var rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier();
|
|
||||||
var outputDirectory = PublishApp(testAppName, rid, mode: "fx-dependent-no-exe");
|
|
||||||
|
|
||||||
outputDirectory.Should().OnlyHaveFiles(new[] {
|
|
||||||
$"{testAppName}.dll",
|
|
||||||
$"{testAppName}.pdb",
|
|
||||||
$"{testAppName}.deps.json",
|
|
||||||
$"{testAppName}.runtimeconfig.json",
|
|
||||||
});
|
|
||||||
|
|
||||||
new DotnetCommand()
|
new DotnetCommand()
|
||||||
.ExecuteWithCapturedOutput(Path.Combine(outputDirectory.FullName, $"{testAppName}.dll"))
|
.ExecuteWithCapturedOutput(Path.Combine(outputDirectory.FullName, $"{testAppName}.dll"))
|
||||||
.Should().Pass()
|
.Should().Pass()
|
||||||
|
@ -166,14 +138,12 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("fx-dependent-no-exe", null)]
|
[InlineData("--self-contained=false")]
|
||||||
[InlineData("fx-dependent", null)]
|
[InlineData(null)]
|
||||||
[InlineData(null, "--self-contained=false")]
|
public void ItPublishesFrameworkDependentWithoutRid(string args)
|
||||||
[InlineData(null, null)]
|
|
||||||
public void ItPublishesFrameworkDependentWithoutRid(string mode, string args)
|
|
||||||
{
|
{
|
||||||
var testAppName = "MSBuildTestApp";
|
var testAppName = "MSBuildTestApp";
|
||||||
var outputDirectory = PublishApp(testAppName, rid: null, mode: mode, args: args);
|
var outputDirectory = PublishApp(testAppName, rid: null, args: args);
|
||||||
|
|
||||||
outputDirectory.Should().OnlyHaveFiles(new[] {
|
outputDirectory.Should().OnlyHaveFiles(new[] {
|
||||||
$"{testAppName}.dll",
|
$"{testAppName}.dll",
|
||||||
|
@ -188,10 +158,10 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
|
||||||
.And.HaveStdOutContaining("Hello World");
|
.And.HaveStdOutContaining("Hello World");
|
||||||
}
|
}
|
||||||
|
|
||||||
private DirectoryInfo PublishApp(string testAppName, string rid, string mode, string args = null)
|
private DirectoryInfo PublishApp(string testAppName, string rid, string args = null)
|
||||||
{
|
{
|
||||||
var testInstance = TestAssets.Get(testAppName)
|
var testInstance = TestAssets.Get(testAppName)
|
||||||
.CreateInstance($"PublishApp_{rid ?? "none"}_{mode ?? "none"}_{args ?? "none"}")
|
.CreateInstance($"PublishApp_{rid ?? "none"}_{args ?? "none"}")
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.WithRestoreFiles();
|
.WithRestoreFiles();
|
||||||
|
|
||||||
|
@ -199,7 +169,6 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
|
||||||
|
|
||||||
new PublishCommand()
|
new PublishCommand()
|
||||||
.WithRuntime(rid)
|
.WithRuntime(rid)
|
||||||
.WithMode(mode)
|
|
||||||
.WithWorkingDirectory(testProjectDirectory)
|
.WithWorkingDirectory(testProjectDirectory)
|
||||||
.Execute(args ?? "")
|
.Execute(args ?? "")
|
||||||
.Should().Pass();
|
.Should().Pass();
|
||||||
|
@ -336,24 +305,5 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
|
||||||
.Should()
|
.Should()
|
||||||
.Fail();
|
.Fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void ItFailsToPublishIfBothModeAndSelfContainedAreSpecified()
|
|
||||||
{
|
|
||||||
var testInstance = TestAssets.Get("MSBuildTestApp")
|
|
||||||
.CreateInstance()
|
|
||||||
.WithSourceFiles()
|
|
||||||
.WithRestoreFiles();
|
|
||||||
|
|
||||||
var testProjectDirectory = testInstance.Root;
|
|
||||||
|
|
||||||
new PublishCommand()
|
|
||||||
.WithWorkingDirectory(testProjectDirectory)
|
|
||||||
.Execute("--self-contained --mode fx-dependent")
|
|
||||||
.Should()
|
|
||||||
.Fail()
|
|
||||||
.And
|
|
||||||
.HaveStdErrContaining(LocalizableStrings.PublishModeAndSelfContainedOptionsConflict);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue