Skip to content

Commit

Permalink
fix(Tests): temporary fix Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabing010102 committed Dec 2, 2023
1 parent 3805523 commit f1927dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Librarian.Common/Librarian.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
<PackageReference Include="Minio" Version="6.0.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0-beta.2" />
<PackageReference Include="TuiHub.Protos" Version="0.2.45" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,12 @@ private void EnsureServer()
GlobalContext.SystemConfig.DbType = ApplicationDbType.MySQL;
GlobalContext.SystemConfig.DbConnStr = Environment.GetEnvironmentVariable("DB_CONN_STR") ??
"server=librarian_test;port=3306;Database=librarian_test;Uid=librarian_test;Pwd=librarian_test;";
// Apply migration
using var dbContext = new ApplicationDbContext();
dbContext.Database.EnsureDeleted();
dbContext.Database.EnsureCreated();
// Add ApplicationDbContext DI
builder.Services.AddDbContext<ApplicationDbContext>();
// Apply migration
using (var scope = builder.Services.BuildServiceProvider().CreateScope())
{
var dbContext = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
dbContext.Database.EnsureDeleted();
dbContext.Database.EnsureCreated();
}
// Add IdGen DI
builder.Services.AddIdGen(GlobalContext.SystemConfig.GeneratorId);
// Add services to the container.
Expand Down

0 comments on commit f1927dd

Please sign in to comment.