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

Fix test assembly discovery #330

Merged
merged 1 commit into from
May 1, 2023
Merged

Fix test assembly discovery #330

merged 1 commit into from
May 1, 2023

Conversation

drewnoakes
Copy link
Owner

CI is broken, failing with messages:

##[error]Testhost process for source(s) 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\Microsoft.TestPlatform.CoreUtilities.dll' exited with error: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet\'.
##[error]Failed to run as a self-contained app.
##[error]  - The application was run as a self-contained app because 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\testhost.runtimeconfig.json' was not found.
##[error]  - If this should be a framework-dependent app, add the 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\testhost.runtimeconfig.json' file and specify the appropriate framework.
##[error]. Please check the diagnostic logs for more information.
##[error]Testhost process for source(s) 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\Microsoft.TestPlatform.PlatformAbstractions.dll' exited with error: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet\'.
##[error]Failed to run as a self-contained app.
##[error]  - The application was run as a self-contained app because 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\testhost.runtimeconfig.json' was not found.
##[error]  - If this should be a framework-dependent app, add the 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\testhost.runtimeconfig.json' file and specify the appropriate framework.
##[error]. Please check the diagnostic logs for more information.
##[error]Testhost process for source(s) 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll' exited with error: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet\'.
##[error]Failed to run as a self-contained app.
##[error]  - The application was run as a self-contained app because 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\testhost.runtimeconfig.json' was not found.
##[error]  - If this should be a framework-dependent app, add the 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\testhost.runtimeconfig.json' file and specify the appropriate framework.
##[error]. Please check the diagnostic logs for more information.
##[error]Testhost process for source(s) 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\testhost.dll' exited with error: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet\'.
##[error]Failed to run as a self-contained app.
##[error]  - The application was run as a self-contained app because 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\testhost.runtimeconfig.json' was not found.
##[error]  - If this should be a framework-dependent app, add the 'D:\a\1\s\MetadataExtractor.Tests\bin\Release\net6.0\testhost.runtimeconfig.json' file and specify the appropriate framework.
##[error]. Please check the diagnostic logs for more information.

I think what's happening is that the default test assembly discovery is matching anything with "test" in its name, and is therefore pulling in Microsoft.TestPlatform.CoreUtilities.dll, Microsoft.TestPlatform.PlatformAbstractions.dll, Microsoft.VisualStudio.TestPlatform.ObjectModel.dll and testhost.dll, none of which can be exectuted for the reasons listed.

This PR makes the test assembly explicit, which should hopefully address the above issues.

Also, run tests in parallel.

Also run tests in parallel.
@drewnoakes
Copy link
Owner Author

Yep, that fixed it. No idea what broke it. Something must have changed on Azure Pipelines.

@drewnoakes drewnoakes merged commit 45033f7 into master May 1, 2023
3 of 4 checks passed
@drewnoakes drewnoakes deleted the fix-test-discovery branch May 1, 2023 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant