Fix issues with Gitea using workers
This commit is contained in:
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using StackExchange.Redis;
|
||||
|
||||
public class GatewayApiFixture : WebApplicationFactory<Program>, IAsyncLifetime
|
||||
@@ -13,9 +14,9 @@ public class GatewayApiFixture : WebApplicationFactory<Program>, IAsyncLifetime
|
||||
Environment.GetEnvironmentVariable("ConnectionStrings__GatewayDb")
|
||||
?? "Host=localhost;Port=5437;Database=vigilcare_ward_test;Username=postgres;Password=password";
|
||||
|
||||
// Never fall back to the API Redis__* env — that points at a different instance/DB index.
|
||||
public static string RedisConnection { get; } =
|
||||
Environment.GetEnvironmentVariable("Gateway__Redis__ConnectionString")
|
||||
?? Environment.GetEnvironmentVariable("Redis__ConnectionString")
|
||||
?? "localhost:6383,defaultDatabase=2,allowAdmin=true";
|
||||
|
||||
protected override void ConfigureWebHost(IWebHostBuilder builder)
|
||||
@@ -30,12 +31,14 @@ public class GatewayApiFixture : WebApplicationFactory<Program>, IAsyncLifetime
|
||||
["RabbitMq:Host"] = Environment.GetEnvironmentVariable("Gateway__RabbitMq__Host")
|
||||
?? Environment.GetEnvironmentVariable("RabbitMq__Host")
|
||||
?? "localhost",
|
||||
// Do not fall back to RabbitMq__Port (API uses 5674); gateway broker is 5675.
|
||||
["RabbitMq:Port"] = Environment.GetEnvironmentVariable("Gateway__RabbitMq__Port")
|
||||
?? Environment.GetEnvironmentVariable("RabbitMq__Port")
|
||||
?? "5675",
|
||||
["RabbitMq:Username"] = Environment.GetEnvironmentVariable("RabbitMq__Username") ?? "guest",
|
||||
["RabbitMq:Password"] = Environment.GetEnvironmentVariable("RabbitMq__Password") ?? "guest",
|
||||
["RabbitMq:PagingAckTimeoutMs"] = "5000",
|
||||
// Neutralize appsettings.Production.json if the process env was Production.
|
||||
["RabbitMq:UseSsl"] = "false",
|
||||
["CentralApi:BaseUrl"] = "http://127.0.0.1:1",
|
||||
["Gateway:GatewayId"] = "22222222-2222-2222-2222-222222222222",
|
||||
["Gateway:SiteId"] = "11111111-1111-1111-1111-111111111111",
|
||||
@@ -54,6 +57,9 @@ public class GatewayApiFixture : WebApplicationFactory<Program>, IAsyncLifetime
|
||||
|
||||
builder.ConfigureServices(services =>
|
||||
{
|
||||
services.Configure<HostOptions>(o =>
|
||||
o.BackgroundServiceExceptionBehavior = BackgroundServiceExceptionBehavior.Ignore);
|
||||
|
||||
services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultAuthenticateScheme = TestingAuthHandler.SchemeName;
|
||||
|
||||
Reference in New Issue
Block a user