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 flaky CI test on Windows #2836
Labels
help-wanted
A change up for grabs for contributions from the community
Milestone
Comments
martincostello
added
the
help-wanted
A change up for grabs for contributions from the community
label
Apr 25, 2024
Failed Swashbuckle.AspNetCore.IntegrationTests.SwaggerIntegrationTests.SwaggerEndpoint_ReturnsValidSwaggerJson(startupType: typeof(OAuth2Integration.Startup), swaggerRequestUri: "/resource-server/swagger/v1/swagger.json") [362 ms]
Error Message:
System.IO.IOException : The process cannot access the file 'D:\a\Swashbuckle.AspNetCore\Swashbuckle.AspNetCore\artifacts\bin\Swashbuckle.AspNetCore.IntegrationTests\release\tempkey.rsa' because it is being used by another process.
Stack Trace:
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.File.WriteAllText(String path, String contents)
at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderExtensionsCrypto.AddDeveloperSigningCredential(IIdentityServerBuilder builder, Boolean persistKey, String filename, RsaSigningAlgorithm signingAlgorithm)
at OAuth2Integration.Startup.ConfigureServices(IServiceCollection services) in /_/test/WebSites/OAuth2Integration/Startup.cs:line 26
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>c__DisplayClass15_0.<BuildStartupServicesFilterPipeline>g__RunPipeline|0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>c__DisplayClass14_0.<ConfigureServices>g__ConfigureServicesWithContainerConfiguration|0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.WebHost.Initialize()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at Microsoft.AspNetCore.TestHost.TestServer..ctor(IWebHostBuilder builder, IFeatureCollection featureCollection)
at Microsoft.AspNetCore.TestHost.TestServer..ctor(IWebHostBuilder builder)
at Swashbuckle.AspNetCore.IntegrationTests.TestSite.BuildServer() in /_/test/Swashbuckle.AspNetCore.IntegrationTests/TestSite.cs:line 29
at Swashbuckle.AspNetCore.IntegrationTests.TestSite.BuildClient() in /_/test/Swashbuckle.AspNetCore.IntegrationTests/TestSite.cs:line 34
at Swashbuckle.AspNetCore.IntegrationTests.SwaggerIntegrationTests.SwaggerEndpoint_ReturnsValidSwaggerJson(Type startupType, String swaggerRequestUri) in /_/test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerIntegrationTests.cs:line 34
--- End of stack trace from previous location --- |
Updating this target to do a few retries if there's an file write conflict should fix most cases of that problem:
|
martincostello
added a commit
to martincostello/Swashbuckle.AspNetCore
that referenced
this issue
May 1, 2024
Refactor coverage report for GitHub step summary to try and resolve file conflict issues (and make the code more readable). Contributes to domaindrivendev#2836.
martincostello
added a commit
that referenced
this issue
May 6, 2024
Refactor coverage report for GitHub step summary to try and resolve file conflict issues (and make the code more readable). Contributes to #2836.
I think this is resolved now since #2848. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The tests on Windows are being a bit flaky due to some file copy conflicts during the build of the test projects.
Need to do something to resolve that.
The text was updated successfully, but these errors were encountered: