Skip to content

Commit 41828e8

Browse files
committed
gh-8 Update integration test
Signed-off-by: Victor Chang <[email protected]>
1 parent ae4db16 commit 41828e8

File tree

6 files changed

+27
-9
lines changed

6 files changed

+27
-9
lines changed

src/InformaticsGateway/Logging/Log.800.Hl7Service.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,11 @@ public static partial class Log
2525

2626
[LoggerMessage(EventId = 805, Level = LogLevel.Information, Message = "Maximum number {maximumAllowedConcurrentConnections} of clients reached.")]
2727
public static partial void MaxedOutHl7Connections(this ILogger logger, int maximumAllowedConcurrentConnections);
28+
29+
[LoggerMessage(EventId = 806, Level = LogLevel.Information, Message = "HL7 listening on port: {port}.")]
30+
public static partial void Hl7ListeningOnPort(this ILogger logger, int port);
31+
32+
[LoggerMessage(EventId = 807, Level = LogLevel.Critical, Message = "Socket error: {error}")]
33+
public static partial void Hl7SocketException(this ILogger logger, string error);
2834
}
2935
}

src/InformaticsGateway/Program.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using Monai.Deploy.InformaticsGateway.Services.Common;
2121
using Monai.Deploy.InformaticsGateway.Services.Connectors;
2222
using Monai.Deploy.InformaticsGateway.Services.DicomWeb;
23+
using Monai.Deploy.InformaticsGateway.Services.Export;
2324
using Monai.Deploy.InformaticsGateway.Services.HealthLevel7;
2425
using Monai.Deploy.InformaticsGateway.Services.Http;
2526
using Monai.Deploy.InformaticsGateway.Services.Scp;
@@ -113,8 +114,8 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>
113114
services.AddSingleton<IApplicationEntityManager, ApplicationEntityManager>();
114115
services.AddSingleton<SpaceReclaimerService>();
115116
services.AddSingleton<ScpService>();
116-
//services.AddSingleton<ScuExportService>();
117-
//services.AddSingleton<DicomWebExportService>();
117+
services.AddSingleton<ScuExportService>();
118+
services.AddSingleton<DicomWebExportService>();
118119
services.AddSingleton<DataRetrievalService>();
119120
services.AddSingleton<PayloadNotificationService>();
120121
services.AddSingleton<MllpService>();
@@ -137,8 +138,8 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>
137138
services.AddHostedService<SpaceReclaimerService>(p => p.GetService<SpaceReclaimerService>());
138139
services.AddHostedService<DataRetrievalService>(p => p.GetService<DataRetrievalService>());
139140
services.AddHostedService<ScpService>(p => p.GetService<ScpService>());
140-
//services.AddHostedService<ScuExportService>(p => p.GetService<ScuExportService>());
141-
//services.AddHostedService<DicomWebExportService>(p => p.GetService<DicomWebExportService>());
141+
services.AddHostedService<ScuExportService>(p => p.GetService<ScuExportService>());
142+
services.AddHostedService<DicomWebExportService>(p => p.GetService<DicomWebExportService>());
142143
services.AddHostedService<PayloadNotificationService>(p => p.GetService<PayloadNotificationService>());
143144
services.AddHostedService<MllpService>(p => p.GetService<MllpService>());
144145
})

src/InformaticsGateway/Services/HealthLevel7/MllpService.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7
2020
{
2121
internal sealed class MllpService : IHostedService, IDisposable, IMonaiService
2222
{
23+
private const int SOCKET_OPERATION_CANCELLED = 125;
2324
private bool _disposedValue;
2425
private readonly ITcpListener _tcpListener;
2526
private readonly IMllpClientFactory _mllpClientFactory;
@@ -70,6 +71,7 @@ public Task StartAsync(CancellationToken cancellationToken)
7071

7172
Status = ServiceStatus.Running;
7273
_logger.ServiceRunning(ServiceName);
74+
_logger.Hl7ListeningOnPort(_configuration.Value.Hl7.Port);
7375

7476
if (task.IsCompleted)
7577
return task;
@@ -98,6 +100,14 @@ private async Task BackgroundProcessing(CancellationToken cancellationToken)
98100
_ = mllpClient.Start(OnDisconnect, cancellationToken);
99101
_activeTasks.TryAdd(mllpClient.ClientId, mllpClient);
100102
}
103+
catch (System.Net.Sockets.SocketException ex)
104+
{
105+
_logger.Hl7SocketException(ex.Message);
106+
if (ex.ErrorCode == SOCKET_OPERATION_CANCELLED)
107+
{
108+
break;
109+
}
110+
}
101111
catch (Exception ex)
102112
{
103113
_logger.ServiceInvalidOrCancelled(ServiceName, ex);

tests/Integration.Test/.env.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
TAG=0.2.0
1+
TAG=0.3.0

tests/Integration.Test/Features/DicomWebStow.feature.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Integration.Test/run.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,16 @@ function start_services() {
9999

100100
set +e
101101
COUNTER=0
102+
EXPECTEDSERVICE=7
102103
while true; do
103104
info "Waiting for Informatics Gateway ($COUNTER)..."
104105
count=$(curl -s http://$HOST_IP:5000/health/status | jq | grep "running" | wc -l)
105106
info "$count services running..."
106-
if [ $count -eq 6 ]; then
107+
if [ $count -eq $EXPECTEDSERVICE ]; then
107108
break
108109
fi
109110
if [ $COUNTER -gt 100 ]; then
110-
fatal "Timeout waiting for Informatics Gateway ($COUNTER)."
111+
fatal "Timeout waiting for Informatics Gateway services to be ready ($COUNTER/$EXPECTEDSERVICE)."
111112
fi
112113
let COUNTER=COUNTER+1
113114
sleep 1s

0 commit comments

Comments
 (0)