dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.19k stars 9.93k forks source link

SharedFxTests and TargetingPackTests tests are unable to find ASP.NET Core files on local Linux build #57426

Open tmds opened 3 weeks ago

tmds commented 3 weeks ago

When we run the tests in our CI, the following tests fail:

Microsoft.AspNetCore.TargetingPackTests.PlatformManifestListsAllFiles
Microsoft.AspNetCore.TargetingPackTests.PackageOverridesContainsCorrectEntries
Microsoft.AspNetCore.TargetingPackTests.TargetingPackContainsListedAssemblies
Microsoft.AspNetCore.TargetingPackTests.FrameworkListContainsCorrectPaths
Microsoft.AspNetCore.TargetingPackTests.AssembliesAreReferenceAssemblies
Microsoft.AspNetCore.TargetingPackTests.FrameworkListContainsCorrectEntries
Microsoft.AspNetCore.TargetingPackTests.RefAssemblyReferencesHaveExpectedAssemblyVersions
Microsoft.AspNetCore.TargetingPackTests.FrameworkListContainsAnalyzerLanguage
Microsoft.AspNetCore.TargetingPackTests.RefAssembliesHaveExpectedAssemblyVersions
Microsoft.AspNetCore.SharedFxTests.SharedFrameworkContainsValidRuntimeConfigFile
Microsoft.AspNetCore.SharedFxTests.ItContainsVersionFile
Microsoft.AspNetCore.SharedFxTests.SharedFrameworkContainsValidDepsJson
Microsoft.AspNetCore.SharedFxTests.SharedFrameworkContainsExpectedFiles
Microsoft.AspNetCore.SharedFxTests.SharedFrameworkAssembliesHaveExpectedAssemblyVersions
Microsoft.AspNetCore.SharedFxTests.SharedFrameworkContainsListedAssemblies
Microsoft.AspNetCore.SharedFxTests.SharedFrameworkAssemblyReferencesHaveExpectedAssemblyVersions

Example test failure:

System.IO.DirectoryNotFoundException: System.IO.DirectoryNotFoundException : Could not find a part of the path '/home/tester/aspnetcore/.dotnet/packs/Microsoft.AspNetCore.App.Ref/9.0.0-ci/data/PlatformManifest.txt'.

The tests expect the shared framework files and targeting pack files to have been copied over to the DOTNET_ROOT. That did not happen and leads to DirectoryNotFoundException/FileNotFoundException in the tests.

Our CI runs into the issue while executing all tests (--test on the eng/build.sh script). This is a smaller reproducer:

./restore.sh 
source activate.sh 
cd src/Framework/test/
dotnet build
dotnet test

@dougbu @wtgodbe do you know what is missing to have the files copied over to DOTNET_ROOT by the time these tests run?

cc @omajid

wtgodbe commented 3 weeks ago

It's possible the layout for local builds changed with https://github.com/dotnet/aspnetcore/pull/54084. We only run these tests in Helix today, where we have different conditions for locating the data files like PlatformManifest.txt. Are you able to just skip these tests? What scenario are you running your CI for?

tmds commented 2 weeks ago

It's possible the layout for local builds changed with https://github.com/dotnet/aspnetcore/pull/54084

I think all the tests were passing when I was working on https://github.com/dotnet/aspnetcore/pull/46600, which was merged Feb 14. The PR you referenced was merged Mar 19. It may have regressed there.

Are you able to just skip these tests? What scenario are you running your CI for?

Our CI runs a very broad set of tests by invoking ./eng/build.sh with the --test argument. We run the CI jobs on the different distro that we build .NET distro packages for.

I don't know how to skip these particular tests. Perhaps they can be made to work again to when using the --test argument, or perhaps they can be excluded (since they are known to fail)?

wtgodbe commented 2 weeks ago

These tests really only provide value in our CI on Helix - we'd accept a PR to skip them elsewhere by adding this attribute to the failing tests:

[SkipNonHelix("https://github.com/dotnet/aspnetcore/issues/57426")]

e.g. https://github.com/dotnet/aspnetcore/blob/a94b1b7bd2f8d7f2aeabe68c67984633da3ee190/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/InProcess/IISExpressShutdownTests.cs#L78