Skip to content

Commit

Permalink
Retry HL7 upload verification
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Chang <vicchang@nvidia.com>
  • Loading branch information
mocsharp committed Sep 26, 2022
1 parent f77e666 commit eabd8e1
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions tests/Integration.Test/StepDefinitions/HealthLevel7Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ public async Task ThenMessageAreUploadedToStorageService()

foreach (var file in request.Payload)
{
var retryCount = 0;
var matchFound = false;
RetryVerifyFileUpload:
var getObjectArgs = new GetObjectArgs()
.WithBucket(request.Bucket)
.WithObject($"{request.PayloadId}/{file.Path}")
Expand All @@ -210,7 +213,6 @@ public async Task ThenMessageAreUploadedToStorageService()
var hl7Message = new HL7.Dotnetcore.Message(data);
hl7Message.ParseMessage();
var matchFound = false;
foreach (var key in _input.Keys)
{
if (hl7Message.HL7Message.Equals(_input[key].SerializeMessage(true)))
Expand All @@ -219,19 +221,14 @@ public async Task ThenMessageAreUploadedToStorageService()
break;
}
}
if (!matchFound)
{
_outputHelper.WriteLine($"HL7 message on MinIO: {hl7Message.HL7Message}");
_outputHelper.WriteLine($"HL7 message in memory:");
foreach (var file in _input.Values)
{
_outputHelper.WriteLine($"file=>{file.SerializeMessage(true)}");
}
}
matchFound.Should().BeTrue();
});
await minioClient.GetObjectAsync(getObjectArgs);
if (retryCount++ < 3 && !matchFound)
{
goto RetryVerifyFileUpload;
}
matchFound.Should().BeTrue();
}
}
}
Expand Down

0 comments on commit eabd8e1

Please sign in to comment.