Fix integration tests
Author: cvium
This commit is contained in:
parent
6655cf4e58
commit
b92880a18b
|
@ -48,6 +48,7 @@ using Jellyfin.Api.Helpers;
|
||||||
using Jellyfin.MediaEncoding.Hls.Playlist;
|
using Jellyfin.MediaEncoding.Hls.Playlist;
|
||||||
using Jellyfin.Networking.Configuration;
|
using Jellyfin.Networking.Configuration;
|
||||||
using Jellyfin.Networking.Manager;
|
using Jellyfin.Networking.Manager;
|
||||||
|
using Jellyfin.Server.Implementations;
|
||||||
using MediaBrowser.Common;
|
using MediaBrowser.Common;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Events;
|
using MediaBrowser.Common.Events;
|
||||||
|
@ -101,6 +102,7 @@ using MediaBrowser.Providers.Subtitles;
|
||||||
using MediaBrowser.XbmcMetadata.Providers;
|
using MediaBrowser.XbmcMetadata.Providers;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
@ -652,6 +654,17 @@ namespace Emby.Server.Implementations
|
||||||
/// <returns>A task representing the service initialization operation.</returns>
|
/// <returns>A task representing the service initialization operation.</returns>
|
||||||
public async Task InitializeServices()
|
public async Task InitializeServices()
|
||||||
{
|
{
|
||||||
|
var jellyfinDb = await Resolve<IDbContextFactory<JellyfinDb>>().CreateDbContextAsync().ConfigureAwait(false);
|
||||||
|
await using (jellyfinDb.ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
if ((await jellyfinDb.Database.GetPendingMigrationsAsync().ConfigureAwait(false)).Any())
|
||||||
|
{
|
||||||
|
Logger.LogInformation("There are pending EFCore migrations in the database. Applying... (This may take a while, do not stop Jellyfin)");
|
||||||
|
await jellyfinDb.Database.MigrateAsync().ConfigureAwait(false);
|
||||||
|
Logger.LogInformation("EFCore migrations applied successfully");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var localizationManager = (LocalizationManager)Resolve<ILocalizationManager>();
|
var localizationManager = (LocalizationManager)Resolve<ILocalizationManager>();
|
||||||
await localizationManager.LoadAll().ConfigureAwait(false);
|
await localizationManager.LoadAll().ConfigureAwait(false);
|
||||||
|
|
||||||
|
|
|
@ -192,16 +192,6 @@ namespace Jellyfin.Server
|
||||||
|
|
||||||
// Re-use the web host service provider in the app host since ASP.NET doesn't allow a custom service collection.
|
// Re-use the web host service provider in the app host since ASP.NET doesn't allow a custom service collection.
|
||||||
appHost.ServiceProvider = webHost.Services;
|
appHost.ServiceProvider = webHost.Services;
|
||||||
var jellyfinDb = await appHost.ServiceProvider.GetRequiredService<IDbContextFactory<JellyfinDb>>().CreateDbContextAsync().ConfigureAwait(false);
|
|
||||||
await using (jellyfinDb.ConfigureAwait(false))
|
|
||||||
{
|
|
||||||
if ((await jellyfinDb.Database.GetPendingMigrationsAsync().ConfigureAwait(false)).Any())
|
|
||||||
{
|
|
||||||
_logger.LogInformation("There are pending EFCore migrations in the database. Applying... (This may take a while, do not stop Jellyfin)");
|
|
||||||
await jellyfinDb.Database.MigrateAsync().ConfigureAwait(false);
|
|
||||||
_logger.LogInformation("EFCore migrations applied successfully");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await appHost.InitializeServices().ConfigureAwait(false);
|
await appHost.InitializeServices().ConfigureAwait(false);
|
||||||
Migrations.MigrationRunner.Run(appHost, _loggerFactory);
|
Migrations.MigrationRunner.Run(appHost, _loggerFactory);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user