mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-24 14:28:09 +08:00
fix: try to fix failed tests in ci
This commit is contained in:
parent
e871a37217
commit
bd345ae949
@ -51,7 +51,10 @@ public static class Extensions
|
||||
|
||||
services.AddScoped<IPersistMessageProcessor, PersistMessageProcessor>();
|
||||
|
||||
services.AddHostedService<PersistMessageBackgroundService>();
|
||||
if (env.EnvironmentName != "test")
|
||||
{
|
||||
services.AddHostedService<PersistMessageBackgroundService>();
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@ -14,15 +14,12 @@ public class PersistMessageBackgroundService(
|
||||
{
|
||||
private PersistMessageOptions _options = options.Value;
|
||||
|
||||
private Task? _executingTask;
|
||||
|
||||
protected override Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
logger.LogInformation("PersistMessage Background Service Start");
|
||||
|
||||
_executingTask = ProcessAsync(stoppingToken);
|
||||
await ProcessAsync(stoppingToken);
|
||||
|
||||
return _executingTask;
|
||||
}
|
||||
|
||||
public override Task StopAsync(CancellationToken cancellationToken)
|
||||
|
||||
@ -95,8 +95,7 @@ where TEntryPoint : class
|
||||
{
|
||||
TestRegistrationServices?.Invoke(services);
|
||||
services.ReplaceSingleton(AddHttpContextAccessorMock);
|
||||
services.RemoveAll<IHostedService>();
|
||||
|
||||
// services.RemoveAll<IHostedService>();
|
||||
services.AddSingleton<PersistMessageBackgroundService>();
|
||||
|
||||
// Register all ITestDataSeeder implementations dynamically
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user