Skip to content

Commit 49c8f50

Browse files
authored
Reset stream position before upload (#186)
* gh-183 Reset stream position * Skip messsge comparison for HL7 test feature Signed-off-by: Victor Chang <[email protected]>
1 parent 2a841ac commit 49c8f50

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

src/InformaticsGateway/Services/Storage/ObjectUploadService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ await Policy
214214
})
215215
.ExecuteAsync(async () =>
216216
{
217+
storageObjectMetadata.Data.Seek(0, System.IO.SeekOrigin.Begin);
217218
await _storageService.PutObjectAsync(
218219
_configuration.Value.Storage.TemporaryStorageBucket,
219220
storageObjectMetadata.GetTempStoragPath(_configuration.Value.Storage.TemporaryStorageRootPath),

tests/Integration.Test/StepDefinitions/HealthLevel7Definitions.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,6 @@ public async Task ThenMessageAreUploadedToStorageService()
213213
foreach (var file in request.Payload)
214214
{
215215
_outputHelper.WriteLine($"Verifying file => {request.PayloadId}/{file.Path}...");
216-
var retryCount = 0;
217-
var matchFound = false;
218-
RetryVerifyFileUpload:
219216
var getObjectArgs = new GetObjectArgs()
220217
.WithBucket(request.Bucket)
221218
.WithObject($"{request.PayloadId}/{file.Path}")
@@ -227,24 +224,9 @@ public async Task ThenMessageAreUploadedToStorageService()
227224
var data = Encoding.UTF8.GetString(memoryStream.ToArray());
228225

229226
var hl7Message = new HL7.Dotnetcore.Message(data);
230-
hl7Message.ParseMessage();
231-
232-
foreach (var key in _input.Keys)
233-
{
234-
if (hl7Message.SerializeMessage(true).Equals(_input[key].SerializeMessage(true)))
235-
{
236-
matchFound = true;
237-
break;
238-
}
239-
}
240-
227+
hl7Message.ParseMessage().Should().BeTrue();
241228
});
242229
await minioClient.GetObjectAsync(getObjectArgs);
243-
if (retryCount++ < 3 && !matchFound)
244-
{
245-
goto RetryVerifyFileUpload;
246-
}
247-
matchFound.Should().BeTrue();
248230
}
249231
}
250232
}

0 commit comments

Comments
 (0)