Skip to content
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 host tests for asset resolution behaviour without fallback graph #83434

Merged
merged 3 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ public static AndConstraint<CommandResultAssertions> HaveUsedFallbackRid(this Co
return usedFallbackRid ? assertion.HaveStdErrContaining(msg) : assertion.NotHaveStdErrContaining(msg);
}

public static AndConstraint<CommandResultAssertions> HaveUsedFrameworkProbe(this CommandResultAssertions assertion, string path, int level)
{
return assertion.HaveStdErrContaining($"probe type=framework dir=[{path}] fx_level={level}");
}

public static AndConstraint<CommandResultAssertions> NotHaveUsedFrameworkProbe(this CommandResultAssertions assertion, string path)
{
return assertion.NotHaveStdErrContaining($"probe type=framework dir=[{path}]");
}

private static string GetAppMockPropertyValue(CommandResultAssertions assertion, string propertyName) =>
GetMockPropertyValue(assertion, $"mock property[{propertyName}] = ");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ protected override void RunTest(string testAssemblyName, string appAsmVersion, s
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
.And.HaveResolvedAssembly(expectedTestAssemblyPath);
.And.HaveResolvedAssembly(expectedTestAssemblyPath)
.And.HaveUsedFrameworkProbe(SharedState.DotNetWithNetCoreApp.GreatestVersionSharedFxPath, level: 1);
}
}

Expand Down Expand Up @@ -154,7 +155,8 @@ protected override void RunTest(string testAssemblyName, string appAsmVersion, s
.Execute()
.Should().Pass()
.And.HaveUsedAdditionalDeps(additionalDependency.DepsJson)
.And.HaveResolvedAssembly(expectedTestAssemblyPath);
.And.HaveResolvedAssembly(expectedTestAssemblyPath)
.And.HaveUsedFrameworkProbe(SharedState.DotNetWithNetCoreApp.GreatestVersionSharedFxPath, level: 1);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public PerAssemblyVersionResolutionMultipleFrameworksBase(SharedTestState fixtur
// The test framework above has 4 assemblies in it each with different set of assembly and file versions.
// NetCoreApp HighWare
// - TestAssemblyWithNoVersions: null , null null , null
// - TestAssemblyWithAssemblyVersion: 2.1.1.1, null 2.1.1.2, null
// - TestAssemblyWithAssemblyVersion: 2.1.1.1, null 2.1.1.2, null
// - TestAssemblyWithFileVersion: null , 3.2.2.2 null , 3.2.2.2
// - TestAssemblyWithBothVersions: 2.1.1.1, 3.2.2.2 2.1.1.0, 3.2.2.0
private const string TestAssemblyWithNoVersions = "Test.Assembly.NoVersions";
Expand Down Expand Up @@ -80,13 +80,14 @@ public void AppWithExactlySameAssemblyAsFrameworkWithRollForward(string framewor

public class SharedTestState : ComponentSharedTestStateBase
{
public string HighWarePath => Path.Combine(DotNetWithNetCoreApp.BinPath, "shared", HighWare, "1.1.1");

public SharedTestState()
{
}

protected override TestApp CreateTestFrameworkReferenceApp() => CreateFrameworkReferenceApp(HighWare, "1.1.1");


protected override void CustomizeDotNetWithNetCoreAppMicrosoftNETCoreApp(NetCoreAppBuilder builder)
{
builder
Expand Down Expand Up @@ -152,7 +153,7 @@ protected override void RunTest(Action<RuntimeConfig> runtimeConfigCustomizer, s
string expectedBaseLocation = frameworkWins switch
{
MicrosoftNETCoreApp => SharedState.DotNetWithNetCoreApp.GreatestVersionSharedFxPath,
HighWare => Path.Combine(SharedState.DotNetWithNetCoreApp.BinPath, "shared", HighWare, "1.1.1"),
HighWare => SharedState.HighWarePath,
_ => app.Location,
};
string expectedTestAssemblyPath = Path.Combine(expectedBaseLocation, testAssemblyName + ".dll");
Expand All @@ -161,7 +162,9 @@ protected override void RunTest(Action<RuntimeConfig> runtimeConfigCustomizer, s
.EnableTracingAndCaptureOutputs()
.Execute()
.Should().Pass()
.And.HaveResolvedAssembly(expectedTestAssemblyPath);
.And.HaveResolvedAssembly(expectedTestAssemblyPath)
.And.HaveUsedFrameworkProbe(SharedState.HighWarePath, level: 1)
.And.HaveUsedFrameworkProbe(SharedState.DotNetWithNetCoreApp.GreatestVersionSharedFxPath, level: 2);
}
}

Expand Down Expand Up @@ -194,7 +197,9 @@ protected override void RunTest(Action<RuntimeConfig> runtimeConfigCustomizer, s
SharedState.RunComponentResolutionTest(component)
.Should().Pass()
.And.HaveSuccessfullyResolvedComponentDependencies()
.And.HaveResolvedComponentDependencyAssembly($"{component.AppDll};{expectedTestAssemblyPath}");
.And.HaveResolvedComponentDependencyAssembly($"{component.AppDll};{expectedTestAssemblyPath}")
.And.NotHaveUsedFrameworkProbe(SharedState.HighWarePath)
.And.NotHaveUsedFrameworkProbe(SharedState.DotNetWithNetCoreApp.GreatestVersionSharedFxPath);
}
}
}
Loading