Merge remote-tracking branch 'cli/release/2.2.1xx' into merge-cli/release/2.2.1xx-to-core-sdk/master
This commit is contained in:
commit
29d3640768
36 changed files with 703 additions and 75 deletions
|
@ -48,9 +48,6 @@ namespace EndToEnd
|
|||
var restoredVersion = GetAspNetCoreAppVersion(assetsFile, portable: true);
|
||||
restoredVersion.Should().NotBeNull();
|
||||
|
||||
var bundledVersionPath = Path.Combine(projectDirectory, ".BundledAspNetCoreVersion");
|
||||
var bundledVersion = File.ReadAllText(bundledVersionPath).Trim();
|
||||
|
||||
restoredVersion.ToNormalizedString().Should().BeEquivalentTo(bundledVersion,
|
||||
"The bundled aspnetcore versions set in Microsoft.NETCoreSdk.BundledVersions.props should be idenitical to the versions set in DependencyVersions.props." +
|
||||
"Please update MSBuildExtensions.targets in this repo so these versions match.");
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
.HaveStdOutContaining("Hello Portable World!");;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip="https://github.com/dotnet/cli/issues/9688")]
|
||||
public void ItCanRunToolsThatPrefersTheCliRuntimeEvenWhenTheToolItselfDeclaresADifferentRuntime()
|
||||
{
|
||||
var testInstance = TestAssets.Get("MSBuildTestApp")
|
||||
|
@ -102,7 +102,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
|||
.And.HaveStdOutContaining("Hello I prefer the cli runtime World!");;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip="https://github.com/dotnet/cli/issues/9688")]
|
||||
public void ItCanRunAToolThatInvokesADependencyToolInACSProj()
|
||||
{
|
||||
var repoDirectoriesProvider = new RepoDirectoriesProvider();
|
||||
|
|
90
test/EndToEnd/GivenFrameworkDependentApps.cs
Normal file
90
test/EndToEnd/GivenFrameworkDependentApps.cs
Normal file
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using NuGet.ProjectModel;
|
||||
using NuGet.Versioning;
|
||||
using Xunit;
|
||||
|
||||
namespace EndToEnd
|
||||
{
|
||||
public class GivenFrameworkDependentApps : TestBase
|
||||
{
|
||||
[Theory]
|
||||
[ClassData(typeof(SupportedNetCoreAppVersions))]
|
||||
public void ItDoesNotRollForwardToTheLatestVersion(string minorVersion)
|
||||
{
|
||||
var _testInstance = TestAssets.Get("TestAppSimple")
|
||||
.CreateInstance(identifier: minorVersion)
|
||||
// scope the feed to only dotnet-core feed to avoid flaky when different feed has a newer / lower version
|
||||
.WithNuGetConfig(new RepoDirectoriesProvider().TestPackages)
|
||||
.WithSourceFiles();
|
||||
|
||||
string projectDirectory = _testInstance.Root.FullName;
|
||||
|
||||
string projectPath = Path.Combine(projectDirectory, "TestAppSimple.csproj");
|
||||
|
||||
var project = XDocument.Load(projectPath);
|
||||
var ns = project.Root.Name.Namespace;
|
||||
|
||||
// Update TargetFramework to the right version of .NET Core
|
||||
project.Root.Element(ns + "PropertyGroup")
|
||||
.Element(ns + "TargetFramework")
|
||||
.Value = "netcoreapp" + minorVersion;
|
||||
|
||||
project.Save(projectPath);
|
||||
|
||||
// Get the resolved version of .NET Core
|
||||
new RestoreCommand()
|
||||
.WithWorkingDirectory(projectDirectory)
|
||||
.Execute()
|
||||
.Should().Pass();
|
||||
|
||||
string assetsFilePath = Path.Combine(projectDirectory, "obj", "project.assets.json");
|
||||
var assetsFile = new LockFileFormat().Read(assetsFilePath);
|
||||
|
||||
var versionInAssertsJson = GetNetCoreAppVersion(assetsFile);
|
||||
versionInAssertsJson.Should().NotBeNull();
|
||||
|
||||
if (versionInAssertsJson.IsPrerelease && versionInAssertsJson.Patch == 0)
|
||||
{
|
||||
// if the bundled version is, for example, a prerelease of
|
||||
// .NET Core 2.1.1, that we don't roll forward to that prerelease
|
||||
// version for framework-dependent deployments.
|
||||
return;
|
||||
}
|
||||
|
||||
versionInAssertsJson.ToNormalizedString().Should().BeEquivalentTo(GetExpectedVersion(minorVersion));
|
||||
}
|
||||
|
||||
private NuGetVersion GetNetCoreAppVersion(LockFile lockFile)
|
||||
{
|
||||
return lockFile?.Targets?.SingleOrDefault(t => t.RuntimeIdentifier == null)
|
||||
?.Libraries?.SingleOrDefault(l =>
|
||||
string.Compare(l.Name, "Microsoft.NETCore.App", StringComparison.CurrentCultureIgnoreCase) == 0)
|
||||
?.Version;
|
||||
}
|
||||
|
||||
public string GetExpectedVersion(string minorVersion)
|
||||
{
|
||||
if (minorVersion.StartsWith("1.0"))
|
||||
{
|
||||
return "1.0.5"; // special case for 1.0
|
||||
}
|
||||
else if (minorVersion.StartsWith("1.1"))
|
||||
{
|
||||
return "1.1.2"; // special case for 1.1
|
||||
}
|
||||
else
|
||||
{
|
||||
var parsed = NuGetVersion.Parse(minorVersion);
|
||||
return new NuGetVersion(parsed.Major, parsed.Minor, 0).ToNormalizedString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -14,15 +13,22 @@ using Xunit;
|
|||
|
||||
namespace EndToEnd
|
||||
{
|
||||
public class GivenSelfContainedAppsRollForward : TestBase
|
||||
public partial class GivenSelfContainedAppsRollForward : TestBase
|
||||
{
|
||||
|
||||
[Theory(Skip = "Runtime 1.1 support for openSUSE and Fedora 27 needed")]
|
||||
[Theory]
|
||||
// MemberData is used instead of InlineData here so we can access it in another test to
|
||||
// verify that we are covering the latest release of .NET Core
|
||||
[MemberData(nameof(SupportedNetCoreAppVersions))]
|
||||
[ClassData(typeof(SupportedNetCoreAppVersions))]
|
||||
public void ItRollsForwardToTheLatestVersion(string minorVersion)
|
||||
{
|
||||
// https://github.com/dotnet/cli/issues/9661: remove this once the ASP.NET version bump
|
||||
// merges from 2.1.3xx -> 2.1.4xx -> 2.2.1xx
|
||||
if (minorVersion == "2.1")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var _testInstance = TestAssets.Get("TestAppSimple")
|
||||
.CreateInstance(identifier: minorVersion)
|
||||
.WithSourceFiles();
|
||||
|
@ -119,8 +125,8 @@ namespace EndToEnd
|
|||
.Element(ns + "TargetFramework")
|
||||
.Value;
|
||||
|
||||
SupportedNetCoreAppVersions.Select(v => $"netcoreapp{v[0]}")
|
||||
.Should().Contain(targetFramework, $"the {nameof(SupportedNetCoreAppVersions)} property should include the default version " +
|
||||
SupportedNetCoreAppVersions.Versions.Select(v => $"netcoreapp{v[0]}")
|
||||
.Should().Contain(targetFramework, $"the {nameof(SupportedNetCoreAppVersions)}.{nameof(SupportedNetCoreAppVersions.Versions)} property should include the default version " +
|
||||
"of .NET Core created by \"dotnet new\"");
|
||||
|
||||
}
|
||||
|
|
26
test/EndToEnd/SupportedNetCoreAppVersions.cs
Normal file
26
test/EndToEnd/SupportedNetCoreAppVersions.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace EndToEnd
|
||||
{
|
||||
public class SupportedNetCoreAppVersions : IEnumerable<object[]>
|
||||
{
|
||||
public IEnumerator<object[]> GetEnumerator() => Versions.GetEnumerator();
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
public static IEnumerable<object[]> Versions
|
||||
{
|
||||
get
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
"1.0",
|
||||
"1.1",
|
||||
"2.0",
|
||||
"2.1"
|
||||
}.Select(version => new object[] { version });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -117,7 +117,7 @@ namespace Microsoft.DotNet.TestFramework
|
|||
var content = @"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key=""dotnet-core"" value=""https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"" />
|
||||
<add key=""dotnet-core"" value=""https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json"" />
|
||||
<add key=""test-packages"" value=""$fullpath$"" />
|
||||
</packageSources>
|
||||
</configuration>";
|
||||
|
|
25
test/dotnet-test.Tests/CollectCodeCoverage.runsettings
Normal file
25
test/dotnet-test.Tests/CollectCodeCoverage.runsettings
Normal file
|
@ -0,0 +1,25 @@
|
|||
<RunSettings>
|
||||
<DataCollectionRunSettings>
|
||||
<DataCollectors>
|
||||
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0">
|
||||
<Configuration>
|
||||
<CodeCoverage>
|
||||
<!-- Match assembly file paths: -->
|
||||
<ModulePaths>
|
||||
<Exclude>
|
||||
<ModulePath>.*Test.dll</ModulePath>
|
||||
</Exclude>
|
||||
</ModulePaths>
|
||||
|
||||
<!-- We recommend you do not change the following values: -->
|
||||
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
|
||||
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
|
||||
<CollectFromChildProcesses>True</CollectFromChildProcesses>
|
||||
<CollectAspDotNet>False</CollectAspDotNet>
|
||||
|
||||
</CodeCoverage>
|
||||
</Configuration>
|
||||
</DataCollector>
|
||||
</DataCollectors>
|
||||
</DataCollectionRunSettings>
|
||||
</RunSettings>
|
Loading…
Add table
Add a link
Reference in a new issue