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

Unit tests are failing randomly for the first run #3515

Closed
ebicoglu opened this issue Apr 8, 2020 · 2 comments · Fixed by #3519
Closed

Unit tests are failing randomly for the first run #3515

ebicoglu opened this issue Apr 8, 2020 · 2 comments · Fixed by #3519

Comments

@ebicoglu
Copy link
Member

ebicoglu commented Apr 8, 2020

When running all unit tests for the first time, it throws the exception:
image

But when I run this failing specific test, it works!
Seems like, there is a file lock problem on tempkey.rsa
The issue is in the IdentityServerBuilderExtensionsCrypto.AddDeveloperSigningCredential method.

Here's the test output

Acme.BookStore.Books.BookAppServiceTests.UpdateAsync
   Source: BookApplicationTests.cs line 71
   Duration: 1 ms

  Message: 
    System.IO.IOException : The process cannot access the file 'C:\MyProjects\2_4_0\mvc\tiered\Acme.BookStore\aspnet-core\test\Acme.BookStore.Application.Tests\bin\Debug\netcoreapp3.1\tempkey.rsa' because it is being used by another process.
  Stack Trace: 
    FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
    FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
    FileStream.ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
    StreamWriter.ctor(String path)
    File.WriteAllText(String path, String contents)
    IdentityServerBuilderExtensionsCrypto.AddDeveloperSigningCredential(IIdentityServerBuilder builder, Boolean persistKey, String filename, RsaSigningAlgorithm signingAlgorithm)
    AbpIdentityServerDomainModule.AddIdentityServer(IServiceCollection services)
    AbpIdentityServerDomainModule.ConfigureServices(ServiceConfigurationContext context)
    ModuleLoader.ConfigureServices(List`1 modules, IServiceCollection services)
    ModuleLoader.LoadModules(IServiceCollection services, Type startupModuleType, PlugInSourceList plugInSources)
    AbpApplicationBase.LoadModules(IServiceCollection services, AbpApplicationCreationOptions options)
    AbpApplicationBase.ctor(Type startupModuleType, IServiceCollection services, Action`1 optionsAction)
    AbpApplicationWithExternalServiceProvider.ctor(Type startupModuleType, IServiceCollection services, Action`1 optionsAction)
    AbpApplicationFactory.Create(Type startupModuleType, IServiceCollection services, Action`1 optionsAction)
    AbpApplicationFactory.Create[TStartupModule](IServiceCollection services, Action`1 optionsAction)
    ServiceCollectionApplicationExtensions.AddApplication[TStartupModule](IServiceCollection services, Action`1 optionsAction)
    AbpIntegratedTest`1.ctor()
    BookStoreTestBase`1.ctor()
    BookStoreApplicationTestBase.ctor()
    BookAppServiceTests.ctor() line 15
@gterdem
Copy link
Contributor

gterdem commented Apr 8, 2020

Didn't we solve this already?

@maliming
Copy link
Member

maliming commented Apr 9, 2020

hi @gterdem
#3519

@ebicoglu ebicoglu modified the milestones: 2.5, 2.6 Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants