Skip to content

Commit 9068fc7

Browse files
authored
Update RetryFact (#207)
Signed-off-by: Victor Chang <[email protected]>
1 parent 71c7e56 commit 9068fc7

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

src/InformaticsGateway/Test/Services/Connectors/PayloadAssemblerTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void GivenAPayloadAssembler_WhenInitialized_ExpectParametersToBeValidated
7474
Assert.Throws<ArgumentNullException>(() => new PayloadAssembler(_options, _logger.Object, null));
7575
}
7676

77-
[RetryFact]
77+
[RetryFact(10,200)]
7878
public async Task GivenAFileStorageMetadata_WhenQueueingWihtoutSpecifyingATimeout_ExpectDefaultTimeoutToBeUsed()
7979
{
8080
var payloadAssembler = new PayloadAssembler(_options, _logger.Object, _serviceScopeFactory.Object);
@@ -88,7 +88,7 @@ public async Task GivenAFileStorageMetadata_WhenQueueingWihtoutSpecifyingATimeou
8888
_cancellationTokenSource.Cancel();
8989
}
9090

91-
[RetryFact]
91+
[RetryFact(10,200)]
9292
public async Task GivenFileStorageMetadataInTheDatabase_AtServiceStartup_ExpectPayloadsInCreatedStateToBeRemoved()
9393
{
9494
var dataset = new List<Payload>
@@ -110,7 +110,7 @@ public async Task GivenFileStorageMetadataInTheDatabase_AtServiceStartup_ExpectP
110110
_repository.Verify(p => p.Remove(It.IsAny<Payload>()), Times.Exactly(2));
111111
}
112112

113-
[RetryFact]
113+
[RetryFact(10,200)]
114114
public async Task GivenAPayloadAssembler_WhenDisposed_ExpectResourceToBeCleanedUp()
115115
{
116116
var payloadAssembler = new PayloadAssembler(_options, _logger.Object, _serviceScopeFactory.Object);
@@ -126,7 +126,7 @@ public async Task GivenAPayloadAssembler_WhenDisposed_ExpectResourceToBeCleanedU
126126
_logger.VerifyLoggingMessageBeginsWith($"Number of collections in queue", LogLevel.Trace, Times.Never());
127127
}
128128

129-
[RetryFact]
129+
[RetryFact(10,200)]
130130
public async Task GivenFileStorageMetadata_WhenQueueingWithDatabaseError_ExpectToRetryXTimes()
131131
{
132132
int callCount = 0;
@@ -152,7 +152,7 @@ public async Task GivenFileStorageMetadata_WhenQueueingWithDatabaseError_ExpectT
152152
_logger.VerifyLoggingMessageBeginsWith($"Number of buckets active: 1.", LogLevel.Trace, Times.AtLeastOnce());
153153
}
154154

155-
[RetryFact]
155+
[RetryFact(10,200)]
156156
public async Task GivenAPayloadThatHasNotCompleteUploads_WhenProcessedByTimedEvent_ExpectToBeAddedToQueue()
157157
{
158158
_repository.Setup(p => p.SaveChangesAsync(It.IsAny<CancellationToken>())).Callback(() =>
@@ -171,7 +171,7 @@ public async Task GivenAPayloadThatHasNotCompleteUploads_WhenProcessedByTimedEve
171171
_logger.VerifyLoggingMessageBeginsWith($"Bucket A sent to processing queue", LogLevel.Information, Times.Never());
172172
}
173173

174-
[RetryFact]
174+
[RetryFact(10,200)]
175175
public async Task GivenAPayloadThatHasCompletedUploads_WhenProcessedByTimedEvent_ExpectToBeAddedToQueue()
176176
{
177177
var payloadAssembler = new PayloadAssembler(_options, _logger.Object, _serviceScopeFactory.Object);

src/InformaticsGateway/Test/Services/Connectors/PayloadMoveActionHandlerTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public PayloadMoveActionHandlerTest()
7070
_options.Value.Storage.StorageServiceBucketName = "bucket";
7171
}
7272

73-
[RetryFact]
73+
[RetryFact(10,200)]
7474
public void GivenAPayloadMoveActionHandler_WhenInitialized_ExpectParametersToBeValidated()
7575
{
7676
Assert.Throws<ArgumentNullException>(() => new PayloadMoveActionHandler(null, null, null));
@@ -80,7 +80,7 @@ public void GivenAPayloadMoveActionHandler_WhenInitialized_ExpectParametersToBeV
8080
_ = new PayloadMoveActionHandler(_serviceScopeFactory.Object, _logger.Object, _options);
8181
}
8282

83-
[RetryFact]
83+
[RetryFact(10,200)]
8484
public async Task GivenAPayloadInIncorrectState_WhenHandlerIsCalled_ExpectExceptionToBeThrown()
8585
{
8686
var resetEvent = new ManualResetEventSlim();
@@ -144,7 +144,7 @@ public async Task GivenAPayload_WhenHandlerFailedToCopyFiles_ExpectToBePutBackIn
144144
Assert.Equal(retryCount + 1, payload.RetryCount);
145145
}
146146

147-
[RetryFact]
147+
[RetryFact(10,200)]
148148
public async Task GivenAPayloadThatHasReachedMaximumRetries_WhenHandlerFailedToCopyFiles_ExpectPayloadToBeDeleted()
149149
{
150150
var moveAction = new ActionBlock<Payload>(payload =>
@@ -175,7 +175,7 @@ public async Task GivenAPayloadThatHasReachedMaximumRetries_WhenHandlerFailedToC
175175
_repository.Verify(p => p.Remove(payload), Times.Once());
176176
}
177177

178-
[RetryFact]
178+
[RetryFact(10,200)]
179179
public async Task GivenAPayload_WhenAllFilesAreMove_ExpectPayloadToBeAddedToNotificationQueue()
180180
{
181181
var notifyEvent = new ManualResetEventSlim();

src/InformaticsGateway/Test/Services/Connectors/PayloadNotificationServiceTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ public PayloadNotificationServiceTest()
8585
_logger.Setup(p => p.IsEnabled(It.IsAny<LogLevel>())).Returns(true);
8686
}
8787

88-
[RetryFact]
88+
[RetryFact(10,200)]
8989
public void GivenAPayloadNotificationService_AtInitialization_ExpectParametersToBeValidated()
9090
{
9191
Assert.Throws<ArgumentNullException>(() => new PayloadNotificationService(null, null, null));
9292
Assert.Throws<ArgumentNullException>(() => new PayloadNotificationService(_serviceScopeFactory.Object, null, null));
9393
Assert.Throws<ArgumentNullException>(() => new PayloadNotificationService(_serviceScopeFactory.Object, _logger.Object, null));
9494
}
9595

96-
[RetryFact]
96+
[RetryFact(10,200)]
9797
public async Task GivenThePayloadNotificationService_WhenStopAsyncIsCalled_ExpectServiceToStopAnyProcessing()
9898
{
9999
var payload = new Payload("test", Guid.NewGuid().ToString(), 100) { State = Payload.PayloadState.Move };
@@ -116,7 +116,7 @@ public async Task GivenThePayloadNotificationService_WhenStopAsyncIsCalled_Expec
116116
_logger.VerifyLogging($"Uploading payload {payload.Id} to storage service at {_options.Value.Storage.StorageServiceBucketName}.", LogLevel.Information, Times.Never());
117117
}
118118

119-
[RetryFact]
119+
[RetryFact(10,200)]
120120
public void GivenPayloadsStoredInTheDatabase_WhenServiceStarts_ExpectThePayloadsToBeRestored()
121121
{
122122
var testData = new List<Payload>
@@ -139,7 +139,7 @@ public void GivenPayloadsStoredInTheDatabase_WhenServiceStarts_ExpectThePayloads
139139
_payloadNotificationActionHandler.Verify(p => p.NotifyAsync(It.IsAny<Payload>(), It.IsAny<ActionBlock<Payload>>(), It.IsAny<CancellationToken>()), Times.AtLeastOnce());
140140
}
141141

142-
[RetryFact]
142+
[RetryFact(10,200)]
143143
public void GivenAPayload_WhenDequedFromPayloadAssemblerAndFailedToBeProcessByTheMoveActionHandler()
144144
{
145145
var resetEvent = new ManualResetEventSlim();
@@ -157,7 +157,7 @@ public void GivenAPayload_WhenDequedFromPayloadAssemblerAndFailedToBeProcessByTh
157157
resetEvent.Wait();
158158
}
159159

160-
[RetryFact]
160+
[RetryFact(10,200)]
161161
public void GivenAPayload_WhenDequedFromPayloadAssembler_ExpectThePayloadBeProcessedByTheMoveActionHandler()
162162
{
163163
var payload = new Payload("test", Guid.NewGuid().ToString(), 100) { State = Payload.PayloadState.Move };

src/InformaticsGateway/Test/Services/Fhir/FhirServiceTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public FhirServiceTest()
8585
_options.Value.Storage.TemporaryDataStorage = TemporaryDataStorageLocation.Memory;
8686
}
8787

88-
[RetryFact]
88+
[RetryFact(10,200)]
8989
public void GivenAFhirService_WhenInitialized_ExpectParametersToBeValidated()
9090
{
9191
Assert.Throws<ArgumentNullException>(() => new FhirService(null, null));
@@ -94,7 +94,7 @@ public void GivenAFhirService_WhenInitialized_ExpectParametersToBeValidated()
9494
new FhirService(_serviceScopeFactory.Object, _options);
9595
}
9696

97-
[RetryFact]
97+
[RetryFact(10,200)]
9898
public async Task StoreAsync_WhenCalled_ShallValidateParametersAsync()
9999
{
100100
var correlationId = Guid.NewGuid().ToString();

src/InformaticsGateway/Test/Services/Scu/ScuServiceTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public ScuServiceTest(DicomScpFixture dicomScp)
7171
_dicomScp.Start(_port);
7272
}
7373

74-
[RetryFact]
74+
[RetryFact(10,200)]
7575
public void GivenAScuService_WhenInitialized_ExpectParametersToBeValidated()
7676
{
7777
Assert.Throws<ArgumentNullException>(() => new ScuService(null, null, null));
@@ -80,7 +80,7 @@ public void GivenAScuService_WhenInitialized_ExpectParametersToBeValidated()
8080
_ = new ScuService(_serviceScopeFactory.Object, _logger.Object, _options);
8181
}
8282

83-
[RetryFact]
83+
[RetryFact(10,200)]
8484
public void GivenAScuService_WhenStartAsyncIsCalled_ExpectServiceStatusToBeSet()
8585
{
8686
var svc = new ScuService(_serviceScopeFactory.Object, _logger.Object, _options);
@@ -89,7 +89,7 @@ public void GivenAScuService_WhenStartAsyncIsCalled_ExpectServiceStatusToBeSet()
8989
Assert.Equal(ServiceStatus.Running, svc.Status);
9090
}
9191

92-
[RetryFact]
92+
[RetryFact(10,200)]
9393
public async Task GivenAValidDicomEntity_WhenRequestToCEcho_ExpectToReturnSucess()
9494
{
9595
var svc = new ScuService(_serviceScopeFactory.Object, _logger.Object, _options);
@@ -106,7 +106,7 @@ public async Task GivenAValidDicomEntity_WhenRequestToCEcho_ExpectToReturnSucess
106106
Assert.Empty(response.Message);
107107
}
108108

109-
[RetryFact]
109+
[RetryFact(10,200)]
110110
public async Task GivenACEchoRequest_WhenRejected_ReturnStatusAssociationRejected()
111111
{
112112
var svc = new ScuService(_serviceScopeFactory.Object, _logger.Object, _options);
@@ -123,7 +123,7 @@ public async Task GivenACEchoRequest_WhenRejected_ReturnStatusAssociationRejecte
123123
Assert.StartsWith("Association rejected", response.Message);
124124
}
125125

126-
[RetryFact]
126+
[RetryFact(10,200)]
127127
public async Task GivenACEchoRequest_WhenAborted_ReturnStatusAssociationAborted()
128128
{
129129
var svc = new ScuService(_serviceScopeFactory.Object, _logger.Object, _options);
@@ -140,7 +140,7 @@ public async Task GivenACEchoRequest_WhenAborted_ReturnStatusAssociationAborted(
140140
Assert.StartsWith("Association Abort", response.Message);
141141
}
142142

143-
[RetryFact]
143+
[RetryFact(10,200)]
144144
public async Task GivenACEchoRequest_WhenRemoteServerIsUnreachable_ReturnStatusAssociationRejected()
145145
{
146146
var svc = new ScuService(_serviceScopeFactory.Object, _logger.Object, _options);

0 commit comments

Comments
 (0)