-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test which reproduces but in complex framework resolution #71959
Merged
vitek-karas
merged 1 commit into
dotnet:main
from
vitek-karas:AddFrameworkResolutionTest
Jul 12, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
src/installer/tests/HostActivation.Tests/FrameworkResolution/ComplexHierarchies.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.DotNet.Cli.Build; | ||
using Microsoft.DotNet.Cli.Build.Framework; | ||
using System; | ||
using Xunit; | ||
|
||
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.FrameworkResolution | ||
{ | ||
public class ComplexHierarchies : | ||
FrameworkResolutionBase, | ||
IClassFixture<ComplexHierarchies.SharedTestState> | ||
{ | ||
private SharedTestState SharedState { get; } | ||
|
||
public ComplexHierarchies(SharedTestState sharedState) | ||
{ | ||
SharedState = sharedState; | ||
} | ||
|
||
public class SharedTestState : SharedTestStateBase | ||
{ | ||
public TestApp FrameworkReferenceApp { get; } | ||
|
||
public DotNetCli DotNetWithMultipleFrameworks { get; } | ||
|
||
public SharedTestState() | ||
{ | ||
DotNetWithMultipleFrameworks = DotNet("DotNetWithMultipleFrameworks") | ||
.AddMicrosoftNETCoreAppFrameworkMockHostPolicy("5.1.1") | ||
.AddFramework("MiddleWare", "2.1.2", runtimeConfig => | ||
runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.1")) | ||
.AddFramework("SerializerWare", "3.0.1", runtimeConfig => | ||
runtimeConfig | ||
.WithFramework(MicrosoftNETCoreApp, "5.1.0") | ||
.WithFramework("MiddleWare", "2.1.0")) | ||
.AddFramework("OMWare", "7.3.1", runtimeConfig => | ||
runtimeConfig | ||
.WithFramework(MicrosoftNETCoreApp, "5.1.0") | ||
.WithFramework("MiddleWare", "2.1.0")) | ||
.Build(); | ||
|
||
FrameworkReferenceApp = CreateFrameworkReferenceApp(); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void TwoAppFrameworksOnTopOfMiddleWare() | ||
{ | ||
RunTest( | ||
runtimeConfig => runtimeConfig | ||
.WithFramework(MicrosoftNETCoreApp, "5.1.0") | ||
.WithFramework("MiddleWare", "2.1.0") | ||
.WithFramework("SerializerWare", "3.0.1") | ||
.WithFramework("OMWare", "7.3.1")) | ||
// https://github.com/dotnet/runtime/issues/71027 | ||
// This should pass just fine and resolve all frameworks correctly | ||
// Currently it fails because it does resolve frameworks, but incorrectly | ||
// looks for hostpolicy in MiddleWare, instead of Microsoft.NETCore.App. | ||
.Should().Fail().And.HaveStdErrContaining("hostpolicy"); | ||
//.ShouldHaveResolvedFramework( | ||
// MicrosoftNETCoreApp, "5.1.1") | ||
//.And.HaveResolvedFramework("MiddleWare", "2.1.") | ||
//.And.HaveResolvedFramework("SerializerWare", "3.0.1") | ||
//.And.HaveResolvedFramework("OMWare", "7.3.1"); | ||
} | ||
|
||
private CommandResult RunTest( | ||
Func<RuntimeConfig, RuntimeConfig> runtimeConfig, | ||
Action<DotNetCliExtensions.DotNetCliCustomizer> customizeDotNet = null, | ||
bool rollForwardToPreRelease = false) | ||
{ | ||
return RunTest( | ||
SharedState.DotNetWithMultipleFrameworks, | ||
SharedState.FrameworkReferenceApp, | ||
new TestSettings() | ||
.WithRuntimeConfigCustomizer(runtimeConfig) | ||
.WithDotnetCustomizer(customizeDotNet) | ||
.WithEnvironment(Constants.RollForwardToPreRelease.EnvironmentVariable, rollForwardToPreRelease ? "1" : "0")); | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would still be an issue with just one framework on top of MiddleWare, as long as it lists MiddleWare last instead of NETCore.App, right? Or does is need the two both doing that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - it probably would fail with just one... I added two as it's closer to the original customer reported repro.