Skip to content

Commit 67920ff

Browse files
committed
add ilogger to test services and remove direct construction with logger
1 parent 5aaabe6 commit 67920ff

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/ServiceControl.Transports.PostgreSql.Tests/TransportTestsConfiguration.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{
33
using System;
44
using System.Threading.Tasks;
5-
using ServiceControl.Infrastructure;
65
using ServiceControl.Transports.PostgreSql;
76
using Transports;
87

@@ -14,7 +13,7 @@ partial class TransportTestsConfiguration
1413

1514
public Task Configure()
1615
{
17-
TransportCustomization = new PostgreSqlTransportCustomization(LoggerUtil.CreateStaticLogger<PostgreSqlTransportCustomization>());
16+
TransportCustomization = new PostgreSqlTransportCustomization();
1817
ConnectionString = Environment.GetEnvironmentVariable(ConnectionStringKey);
1918

2019
if (string.IsNullOrEmpty(ConnectionString))

src/ServiceControl.Transports.SQS.Tests/TransportTestsConfiguration.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{
33
using System;
44
using System.Threading.Tasks;
5-
using ServiceControl.Infrastructure;
65
using Transports;
76
using Transports.SQS;
87

@@ -14,7 +13,7 @@ partial class TransportTestsConfiguration
1413

1514
public Task Configure()
1615
{
17-
TransportCustomization = new SQSTransportCustomization(LoggerUtil.CreateStaticLogger<SQSTransportCustomization>());
16+
TransportCustomization = new SQSTransportCustomization();
1817
ConnectionString = Environment.GetEnvironmentVariable(ConnectionStringKey);
1918

2019
if (string.IsNullOrEmpty(ConnectionString))

src/ServiceControl.Transports.SqlServer.Tests/TransportTestsConfiguration.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{
33
using System;
44
using System.Threading.Tasks;
5-
using ServiceControl.Infrastructure;
65
using Transports;
76
using Transports.SqlServer;
87

@@ -14,7 +13,7 @@ partial class TransportTestsConfiguration
1413

1514
public Task Configure()
1615
{
17-
TransportCustomization = new SqlServerTransportCustomization(LoggerUtil.CreateStaticLogger<SqlServerTransportCustomization>());
16+
TransportCustomization = new SqlServerTransportCustomization();
1817
ConnectionString = Environment.GetEnvironmentVariable(ConnectionStringKey);
1918

2019
if (string.IsNullOrEmpty(ConnectionString))

src/ServiceControl.Transports.Tests/TransportTestFixture.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class TransportTestFixture
2020
[SetUp]
2121
public virtual async Task Setup()
2222
{
23+
//TODO remove LogManager usage
2324
LogManager.UseFactory(new TestContextAppenderFactory());
2425
configuration = new TransportTestsConfiguration();
2526
testCancellationTokenSource = Debugger.IsAttached ? new CancellationTokenSource() : new CancellationTokenSource(TestTimeout);
@@ -102,6 +103,7 @@ protected async Task<IAsyncDisposable> StartQueueLengthProvider(string queueName
102103
configuration.TransportCustomization.CustomizeMonitoringEndpoint(new EndpointConfiguration("queueName"), transportSettings);
103104

104105
serviceCollection.AddSingleton<Action<QueueLengthEntry[], EndpointToQueueMapping>>((qlt, _) => onQueueLengthReported(qlt.First()));
106+
serviceCollection.AddLogging();
105107
var serviceProvider = serviceCollection.BuildServiceProvider();
106108

107109
queueLengthProvider = serviceProvider.GetRequiredService<IProvideQueueLength>();

0 commit comments

Comments
 (0)