If i removed new IdentityDbContext( new DbContextOptionsBuilder<IdentityDbContext>().UseSqlite(connection).Options ).GetService<IRelationalDatabaseCreator>().CreateTables();
new PermissionManagementDbContext(
new DbContextOptionsBuilder<PermissionManagementDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
new SettingManagementDbContext(
new DbContextOptionsBuilder<SettingManagementDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
new LanguageManagementDbContext(
new DbContextOptionsBuilder<LanguageManagementDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
new SaasDbContext(
new DbContextOptionsBuilder<SaasDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
Then i am getting following error Message: Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module **************TestBaseModule, **********.TestBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: SQLite Error 1: 'no such table: AbpSettings'.. See the inner exception for details. ---- Microsoft.Data.Sqlite.SqliteException : SQLite Error 1: 'no such table: AbpSettings'.
Stack Trace:
ModuleManager.InitializeModules(ApplicationInitializationContext context)
AbpApplicationBase.InitializeModules()
AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
AbpIntegratedTest1.ctor() **************TestBase
1.ctor()
ProfileManagementApplicationTestBase.ctor()
ARNotificationApplicationServicesTests.ctor() line 29
----- Inner Stack Trace -----
SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
<44 more frames...>
--- End of stack trace from previous location ---
Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
TaskExtensions.WaitAndUnwrapException(Task task)
AsyncContext.Run(Func1 action) AsyncHelper.RunSync(Func
1 action)
**************TestBaseModule.SeedTestData(ApplicationInitializationContext context) line 31
**************TestBaseModule.OnApplicationInitialization(ApplicationInitializationContext context) line 26
OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module)
ModuleManager.InitializeModules(ApplicationInitializationContext context)
using Microsoft.AspNetCore.Hosting;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Sqlite;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.LanguageManagement.EntityFrameworkCore;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.Uow;
using Volo.Saas.EntityFrameworkCore;
namespace *************.EntityFrameworkCore
{
[DependsOn(
typeof(*************TestBaseModule),
typeof(*************EntityFrameworkCoreModule),
typeof(AbpEntityFrameworkCoreSqliteModule)
)]
public class *************EntityFrameworkCoreTestModule : AbpModule
{
private SqliteConnection _sqliteConnection;
public override void ConfigureServices(ServiceConfigurationContext context)
{
ConfigureInMemorySqlite(context.Services);
context.Services.AddSingleton<IWebHostEnvironment>(new WebHostEnvironmentMockEntity());
}
private void ConfigureInMemorySqlite(IServiceCollection services)
{
_sqliteConnection = CreateDatabaseAndGetConnection();
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
services.Configure<AbpDbContextOptions>(options =>
{
options.Configure(context =>
{
context.DbContextOptions.UseSqlite(_sqliteConnection);
});
});
}
public override void OnApplicationShutdown(ApplicationShutdownContext context)
{
_sqliteConnection.Dispose();
}
private static SqliteConnection CreateDatabaseAndGetConnection()
{
var connection = new SqliteConnection("Data Source=:memory:");
connection.Open();
new *************DbContext(
new DbContextOptionsBuilder<*************DbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
new IdentityDbContext(
new DbContextOptionsBuilder<IdentityDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
new PermissionManagementDbContext(
new DbContextOptionsBuilder<PermissionManagementDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
new SettingManagementDbContext(
new DbContextOptionsBuilder<SettingManagementDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
new LanguageManagementDbContext(
new DbContextOptionsBuilder<LanguageManagementDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
new SaasDbContext(
new DbContextOptionsBuilder<SaasDbContext>().UseSqlite(connection).Options
).GetService<IRelationalDatabaseCreator>().CreateTables();
return connection;
}
}
}
hi @EngincanV can we have online session for this?
I am getting this error after running unit test cases. Volo.Abp.AbpInitializationException : An error occurred during ConfigureServices phase of the module *******************.EntityFrameworkCore.*******************tEntityFrameworkCoreTestModule, *******************.EntityFrameworkCore.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details. ---- Microsoft.Data.Sqlite.SqliteException : SQLite Error 1: 'table "AbpUsers" already exists'.
Stack Trace:
AbpApplicationBase.ConfigureServices()
AbpApplicationFactory.Create[TStartupModule](IServiceCollection services, Action`1 optionsAction)
AbpIntegratedTest`1.ctor()
ProfileManagementTestBase`1.ctor()
*******************ApplicationTestBase.ctor()
*******************.ctor() line 15
----- Inner Stack Trace -----
SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
SqliteCommand.GetStatements(Stopwatch timer)+MoveNext()
SqliteDataReader.NextResult()
SqliteCommand.ExecuteReader(CommandBehavior behavior)
SqliteCommand.ExecuteNonQuery()
RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
ProfileManagementEntityFrameworkCoreTestModule.CreateDatabaseAndGetConnection() line 68
ProfileManagementEntityFrameworkCoreTestModule.ConfigureInMemorySqlite(IServiceCollection services) line 37
ProfileManagementEntityFrameworkCoreTestModule.ConfigureServices(ServiceConfigurationContext context) line 31
AbpApplicationBase.ConfigureServices()
Hi, **"The process cannot access the file .Tests\bin\Debug\net5.0\tempkey.jwk' because it is being used by another process." **
this Issue is resolved, but following issue still there.
The active test run was aborted. Reason: Test host process crashed [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 5.0.5) [xUnit.net 00:00:01.60] Discovering: SCV.Litmus.ProfileManagement.EntityFrameworkCore.Tests [xUnit.net 00:00:01.63] Discovered: SCV.Litmus.ProfileManagement.EntityFrameworkCore.Tests [xUnit.net 00:00:01.64] Starting: SCV.Litmus.ProfileManagement.EntityFrameworkCore.Tests The active test run was aborted. Reason: Test host process crashed
Lets have a zoom call first then if requires we will work upon creating sample project,but as per our current timeline its little difficult for us to create sample project which produces our issue.
Hi,
try to connect through online session, I can not provide project. remote is very slow----should we try again?
Hi,We are still not able to figure out what is root cause of this issue. We tried all the tricks suggested by you. though we are able to stopped the creation of tempkey.jwk file but still we are getting same error as "The process cannot access the file **************.Tests\bin\Debug\net5.0\tempkey.jwk' because it is being used by another process." This is seems to be blocker for us and looks like we need to address this issue on priority so could you please schedule live session so that we can work together to identify the issue. Thanks you.
https://support.abp.io/QA/Questions/1667/Regarding-Unit-Test-Case-Issue#answer-4b5f6c2b-392f-3817-6424-39fe3bb53304
Hi, Lets try with zoom again. Or is there any other way to connect online.