Fix tests

This commit is contained in:
Patrick Barron 2023-01-12 11:51:12 -05:00
parent 0f46eca6a4
commit 033ffa9a88
2 changed files with 12 additions and 9 deletions

View File

@ -185,11 +185,7 @@ namespace Jellyfin.Server
try
{
var host = Host.CreateDefaultBuilder()
.ConfigureServices(services =>
{
// NOTE: Called first to ensure app host configuration is fully initialized
appHost.Init(services);
})
.ConfigureServices(services => appHost.Init(services))
.ConfigureWebHostDefaults(webHostBuilder => webHostBuilder.ConfigureWebHostBuilder(appHost, startupConfig, appPaths))
.ConfigureAppConfiguration(config => config.ConfigureAppConfiguration(options, appPaths, startupConfig))
.UseSerilog()

View File

@ -8,6 +8,7 @@ using MediaBrowser.Common;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
@ -78,11 +79,17 @@ namespace Jellyfin.Server.Integration.Tests
commandLineOpts,
startupConfig);
_disposableComponents.Add(appHost);
var serviceCollection = new ServiceCollection();
appHost.Init(serviceCollection);
// Configure the web host builder
Program.ConfigureWebHostBuilder(builder, appHost, startupConfig, appPaths);
builder.ConfigureServices(services => appHost.Init(services))
.ConfigureWebHostBuilder(appHost, startupConfig, appPaths)
.ConfigureAppConfiguration((context, builder) =>
{
builder
.SetBasePath(appPaths.ConfigurationDirectoryPath)
.AddInMemoryCollection(ConfigurationOptions.DefaultConfiguration)
.AddEnvironmentVariables("JELLYFIN_")
.AddInMemoryCollection(commandLineOpts.ConvertToConfig());
});
}
/// <inheritdoc/>