Skip to content

Commit 4a179a6

Browse files
committed
Update tests
1 parent 160df13 commit 4a179a6

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/test/java/com/iexec/worker/amnesia/AmnesiaRecoveryServiceTests.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,12 @@ public void shouldNotRecoverSinceNothingToRecover() {
6363
@Test
6464
public void shouldRecoverByWaiting() {
6565
when(iexecHubService.getLatestBlockNumber()).thenReturn(blockNumber);
66+
when(resultService.isResultZipFound(CHAIN_TASK_ID)).thenReturn(true);
67+
when(replicateService.retrieveAvailableReplicateModelFromContribAuth(any()))
68+
.thenReturn(getStubModel());
6669
when(customFeignClient.getInterruptedReplicates(blockNumber))
6770
.thenReturn(getStubInterruptedReplicateList(RecoveryAction.WAIT));
68-
71+
6972
List<String> recovered = amnesiaRecoveryService.recoverInterruptedReplicates();
7073

7174
assertThat(recovered).isNotEmpty();
@@ -113,6 +116,9 @@ public void shouldAbortSinceConsensusReached() {
113116
when(iexecHubService.getLatestBlockNumber()).thenReturn(blockNumber);
114117
when(customFeignClient.getInterruptedReplicates(blockNumber))
115118
.thenReturn(getStubInterruptedReplicateList(RecoveryAction.ABORT_CONSENSUS_REACHED));
119+
when(resultService.isResultZipFound(CHAIN_TASK_ID)).thenReturn(true);
120+
when(replicateService.retrieveAvailableReplicateModelFromContribAuth(any()))
121+
.thenReturn(getStubModel());
116122

117123
List<String> recovered = amnesiaRecoveryService.recoverInterruptedReplicates();
118124

@@ -127,9 +133,11 @@ public void shouldAbortSinceConsensusReached() {
127133
public void shouldAbortSinceContributionTimeout() {
128134
when(iexecHubService.getLatestBlockNumber()).thenReturn(blockNumber);
129135
when(customFeignClient.getInterruptedReplicates(blockNumber))
130-
.thenReturn(getStubInterruptedReplicateList(
131-
RecoveryAction.ABORT_CONTRIBUTION_TIMEOUT));
132-
136+
.thenReturn(getStubInterruptedReplicateList(RecoveryAction.ABORT_CONTRIBUTION_TIMEOUT));
137+
when(resultService.isResultZipFound(CHAIN_TASK_ID)).thenReturn(true);
138+
when(replicateService.retrieveAvailableReplicateModelFromContribAuth(any()))
139+
.thenReturn(getStubModel());
140+
133141
List<String> recovered = amnesiaRecoveryService.recoverInterruptedReplicates();
134142

135143
assertThat(recovered).isNotEmpty();
@@ -214,7 +222,11 @@ public void shouldCompleteTask() {
214222
when(iexecHubService.getLatestBlockNumber()).thenReturn(blockNumber);
215223
when(customFeignClient.getInterruptedReplicates(blockNumber))
216224
.thenReturn(getStubInterruptedReplicateList(RecoveryAction.COMPLETE));
217-
225+
226+
when(resultService.isResultZipFound(CHAIN_TASK_ID)).thenReturn(true);
227+
when(replicateService.retrieveAvailableReplicateModelFromContribAuth(any()))
228+
.thenReturn(getStubModel());
229+
218230
List<String> recovered = amnesiaRecoveryService.recoverInterruptedReplicates();
219231

220232
assertThat(recovered).isNotEmpty();

0 commit comments

Comments
 (0)