Skip to content

Commit f1ea110

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

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
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
@@ -33,6 +33,7 @@
3333
using Monai.Deploy.InformaticsGateway.Services.Common;
3434
using Monai.Deploy.InformaticsGateway.Services.Connectors;
3535
using Monai.Deploy.InformaticsGateway.Services.DicomWeb;
36+
using Monai.Deploy.InformaticsGateway.Services.Export;
3637
using Monai.Deploy.InformaticsGateway.Services.HealthLevel7;
3738
using Monai.Deploy.InformaticsGateway.Services.Http;
3839
using Monai.Deploy.InformaticsGateway.Services.Scp;
@@ -126,8 +127,8 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>
126127
services.AddSingleton<IApplicationEntityManager, ApplicationEntityManager>();
127128
services.AddSingleton<SpaceReclaimerService>();
128129
services.AddSingleton<ScpService>();
129-
//services.AddSingleton<ScuExportService>();
130-
//services.AddSingleton<DicomWebExportService>();
130+
services.AddSingleton<ScuExportService>();
131+
services.AddSingleton<DicomWebExportService>();
131132
services.AddSingleton<DataRetrievalService>();
132133
services.AddSingleton<PayloadNotificationService>();
133134
services.AddSingleton<MllpService>();
@@ -150,8 +151,8 @@ internal static IHostBuilder CreateHostBuilder(string[] args) =>
150151
services.AddHostedService<SpaceReclaimerService>(p => p.GetService<SpaceReclaimerService>());
151152
services.AddHostedService<DataRetrievalService>(p => p.GetService<DataRetrievalService>());
152153
services.AddHostedService<ScpService>(p => p.GetService<ScpService>());
153-
//services.AddHostedService<ScuExportService>(p => p.GetService<ScuExportService>());
154-
//services.AddHostedService<DicomWebExportService>(p => p.GetService<DicomWebExportService>());
154+
services.AddHostedService<ScuExportService>(p => p.GetService<ScuExportService>());
155+
services.AddHostedService<DicomWebExportService>(p => p.GetService<DicomWebExportService>());
155156
services.AddHostedService<PayloadNotificationService>(p => p.GetService<PayloadNotificationService>());
156157
services.AddHostedService<MllpService>(p => p.GetService<MllpService>());
157158
})

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/run.sh

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

111111
set +e
112112
COUNTER=0
113+
EXPECTEDSERVICE=7
113114
while true; do
114115
info "Waiting for Informatics Gateway ($COUNTER)..."
115116
count=$(curl -s http://$HOST_IP:5000/health/status | jq | grep "running" | wc -l)
116117
info "$count services running..."
117-
if [ $count -eq 6 ]; then
118+
if [ $count -eq $EXPECTEDSERVICE ]; then
118119
break
119120
fi
120121
if [ $COUNTER -gt 100 ]; then
121-
fatal "Timeout waiting for Informatics Gateway ($COUNTER)."
122+
fatal "Timeout waiting for Informatics Gateway services to be ready ($COUNTER/$EXPECTEDSERVICE)."
122123
fi
123124
let COUNTER=COUNTER+1
124125
sleep 1s

0 commit comments

Comments
 (0)