diff --git a/gradle.properties b/gradle.properties
index a72872aca..90c6d730e 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,8 +1,8 @@
version=7.1.0
-iexecCommonVersion=6.0.0
+iexecCommonVersion=6.0.1-NEXT-SNAPSHOT
iexecBlockchainAdapterVersion=7.1.1
iexecResultVersion=7.1.0
-iexecSmsVersion=7.1.0
+iexecSmsVersion=7.1.0-NEXT-SNAPSHOT
nexusUser
nexusPassword
diff --git a/src/main/java/com/iexec/core/configuration/PurgeConfiguration.java b/src/main/java/com/iexec/core/configuration/PurgeConfiguration.java
new file mode 100644
index 000000000..65e97caa2
--- /dev/null
+++ b/src/main/java/com/iexec/core/configuration/PurgeConfiguration.java
@@ -0,0 +1,27 @@
+package com.iexec.core.configuration;
+
+import com.iexec.common.lifecycle.purge.PurgeService;
+import com.iexec.common.lifecycle.purge.Purgeable;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+
+@Configuration
+@Slf4j
+public class PurgeConfiguration {
+ /**
+ * Creates a {@link PurgeService} bean, with a list of all {@link Purgeable} beans as a parameter.
+ *
+ * If no {@link Purgeable} bean is known, then an empty list is passed as a parameter.
+ * This is a special case of Spring IoC, please see
+ * Spring documentation.
+ * @param purgeableServices List of services that can be purged on a task completion
+ * @return An instance of {@link PurgeService} containing a list of all {@link Purgeable} beans.
+ */
+ @Bean
+ PurgeService purgeService(List purgeableServices) {
+ return new PurgeService(purgeableServices);
+ }
+}
diff --git a/src/main/java/com/iexec/core/configuration/SmsConfiguration.java b/src/main/java/com/iexec/core/configuration/SmsConfiguration.java
deleted file mode 100644
index b0cb2bd89..000000000
--- a/src/main/java/com/iexec/core/configuration/SmsConfiguration.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2020 IEXEC BLOCKCHAIN TECH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.iexec.core.configuration;
-
-import com.iexec.sms.api.SmsClient;
-import com.iexec.sms.api.SmsClientBuilder;
-import feign.Logger;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.stereotype.Component;
-
-@Component
-@Getter
-@AllArgsConstructor
-@NoArgsConstructor
-public class SmsConfiguration {
-
- @Value("${sms.protocol}")
- private String protocol;
-
- @Value("${sms.host}")
- private String host;
-
- @Value("${sms.port}")
- private String port;
-
- public String getSmsURL() {
- return protocol + "://" + host + ":" + port;
- }
-
- @Bean
- public SmsClient smsClient() {
- return SmsClientBuilder.getInstance(Logger.Level.NONE, getSmsURL());
- }
-}
diff --git a/src/main/java/com/iexec/core/replicate/ReplicateSupplyService.java b/src/main/java/com/iexec/core/replicate/ReplicateSupplyService.java
index 60ada9cbf..205b90fcd 100644
--- a/src/main/java/com/iexec/core/replicate/ReplicateSupplyService.java
+++ b/src/main/java/com/iexec/core/replicate/ReplicateSupplyService.java
@@ -17,6 +17,8 @@
package com.iexec.core.replicate;
import com.iexec.common.chain.WorkerpoolAuthorization;
+import com.iexec.common.lifecycle.purge.ExpiringTaskMapFactory;
+import com.iexec.common.lifecycle.purge.Purgeable;
import com.iexec.common.notification.TaskNotification;
import com.iexec.common.notification.TaskNotificationExtra;
import com.iexec.common.notification.TaskNotificationType;
@@ -33,22 +35,19 @@
import com.iexec.core.task.update.TaskUpdateRequestManager;
import com.iexec.core.worker.Worker;
import com.iexec.core.worker.WorkerService;
-import net.jodah.expiringmap.ExpiringMap;
import org.springframework.dao.OptimisticLockingFailureException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import java.util.*;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import static com.iexec.common.replicate.ReplicateStatus.*;
-import static com.iexec.core.task.Task.LONGEST_TASK_TIMEOUT;
@Service
-public class ReplicateSupplyService {
+public class ReplicateSupplyService implements Purgeable {
private final ReplicatesService replicatesService;
private final SignatureService signatureService;
@@ -56,10 +55,7 @@ public class ReplicateSupplyService {
private final TaskUpdateRequestManager taskUpdateRequestManager;
private final WorkerService workerService;
private final Web3jService web3jService;
- final Map taskAccessForNewReplicateLocks =
- ExpiringMap.builder()
- .expiration(LONGEST_TASK_TIMEOUT.getSeconds(), TimeUnit.SECONDS)
- .build();
+ final Map taskAccessForNewReplicateLocks = ExpiringTaskMapFactory.getExpiringTaskMap();
public ReplicateSupplyService(ReplicatesService replicatesService,
SignatureService signatureService,
@@ -532,4 +528,17 @@ private TaskAbortCause getTaskAbortCause(Task task) {
return TaskAbortCause.UNKNOWN;
}
}
+
+ // region purge locks
+ @Override
+ public boolean purgeTask(String chainTaskId) {
+ taskAccessForNewReplicateLocks.remove(chainTaskId);
+ return !taskAccessForNewReplicateLocks.containsKey(chainTaskId);
+ }
+
+ @Override
+ public void purgeAllTasksData() {
+ taskAccessForNewReplicateLocks.clear();
+ }
+ // endregion
}
diff --git a/src/main/java/com/iexec/core/sms/SmsClientProviderConfiguration.java b/src/main/java/com/iexec/core/sms/SmsClientProviderConfiguration.java
new file mode 100644
index 000000000..da6b53e63
--- /dev/null
+++ b/src/main/java/com/iexec/core/sms/SmsClientProviderConfiguration.java
@@ -0,0 +1,14 @@
+package com.iexec.core.sms;
+
+import com.iexec.sms.api.SmsClientProvider;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class SmsClientProviderConfiguration {
+
+ @Bean
+ SmsClientProvider smsClientProvider() {
+ return new SmsClientProvider();
+ }
+}
diff --git a/src/main/java/com/iexec/core/sms/SmsService.java b/src/main/java/com/iexec/core/sms/SmsService.java
index 7df4bb4d0..fb24f0fcc 100644
--- a/src/main/java/com/iexec/core/sms/SmsService.java
+++ b/src/main/java/com/iexec/core/sms/SmsService.java
@@ -16,8 +16,15 @@
package com.iexec.core.sms;
+import com.iexec.common.chain.ChainDeal;
+import com.iexec.common.chain.IexecHubAbstractService;
+import com.iexec.common.task.TaskDescription;
+import com.iexec.common.tee.TeeEnclaveProvider;
+import com.iexec.common.tee.TeeUtils;
import com.iexec.common.utils.BytesUtils;
import com.iexec.sms.api.SmsClient;
+import com.iexec.sms.api.SmsClientCreationException;
+import com.iexec.sms.api.SmsClientProvider;
import feign.FeignException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.retry.annotation.Recover;
@@ -30,10 +37,63 @@
@Slf4j
@Service
public class SmsService {
- private final SmsClient smsClient;
+ private final SmsClientProvider smsClientProvider;
+ private final IexecHubAbstractService iexecHubService;
- public SmsService(SmsClient smsClient) {
- this.smsClient = smsClient;
+ public SmsService(SmsClientProvider smsClientProvider, IexecHubAbstractService iexecHubService) {
+ this.smsClientProvider = smsClientProvider;
+ this.iexecHubService = iexecHubService;
+ }
+
+ /**
+ * Checks the following conditions:
+ *
+ * - Given deal exists on-chain;
+ * - The {@link SmsClient} can be created, based on the on-chain deal definition;
+ * - The targeted SMS is configured to run with the task's TEE enclave provider.
+ *
+ *
+ * If any of these conditions is wrong, then the {@link SmsClient} is considered to be not-ready.
+ *
+ * @param chainDealId ID of the on-chain deal related to the task to execute.
+ * @param chainTaskId ID of the on-chain task.
+ * @return {@literal true} if previous conditions are met, {@literal false} otherwise.
+ */
+ public boolean isSmsClientReady(String chainDealId, String chainTaskId) {
+ try {
+ final Optional chainDeal = iexecHubService.getChainDeal(chainDealId);
+ if (chainDeal.isEmpty()) {
+ log.error("No chain deal for given ID [chainDealId: {}]", chainDealId);
+ return false;
+ }
+ final SmsClient smsClient = smsClientProvider.getOrCreateSmsClientForUninitializedTask(chainDeal.get(), chainTaskId);
+ final TeeEnclaveProvider teeEnclaveProviderForDeal = TeeUtils.getTeeEnclaveProvider(chainDeal.get().getTag());
+ return checkSmsTeeEnclaveProvider(smsClient, teeEnclaveProviderForDeal, chainTaskId);
+ } catch (SmsClientCreationException e) {
+ log.error("SmsClient is not ready [chainTaskId: {}]", chainTaskId, e);
+ return false;
+ }
+ }
+
+ private boolean checkSmsTeeEnclaveProvider(SmsClient smsClient,
+ TeeEnclaveProvider teeEnclaveProviderForDeal,
+ String chainTaskId) {
+ final TeeEnclaveProvider smsTeeEnclaveProvider;
+ try {
+ smsTeeEnclaveProvider = smsClient.getTeeEnclaveProvider();
+ } catch (FeignException e) {
+ log.error("Can't retrieve SMS TEE enclave provider [chainTaskId:{}]",
+ chainTaskId, e);
+ return false;
+ }
+
+ if (smsTeeEnclaveProvider != teeEnclaveProviderForDeal) {
+ log.error("SMS is configured for another TEE enclave provider " +
+ "[chainTaskId:{}, teeEnclaveProviderForDeal:{}, smsTeeEnclaveProvider:{}]",
+ chainTaskId, teeEnclaveProviderForDeal, smsTeeEnclaveProvider);
+ return false;
+ }
+ return true;
}
public Optional getEnclaveChallenge(String chainTaskId, boolean isTeeEnabled) {
@@ -44,8 +104,14 @@ public Optional getEnclaveChallenge(String chainTaskId, boolean isTeeEna
@Retryable(value = FeignException.class)
Optional generateEnclaveChallenge(String chainTaskId) {
+ final TaskDescription taskDescription = iexecHubService.getTaskDescription(chainTaskId);
+
+ // SMS client should already have been created once before.
+ // If it couldn't be created, then the task would have been aborted.
+ // So the following won't throw an exception.
+ final SmsClient smsClient = smsClientProvider.getOrCreateSmsClientForTask(taskDescription);
- String teeChallengePublicKey = smsClient.generateTeeChallenge(chainTaskId);
+ final String teeChallengePublicKey = smsClient.generateTeeChallenge(chainTaskId);
if (teeChallengePublicKey == null || teeChallengePublicKey.isEmpty()) {
log.error("An error occurred while getting teeChallengePublicKey [chainTaskId:{}]", chainTaskId);
diff --git a/src/main/java/com/iexec/core/task/Task.java b/src/main/java/com/iexec/core/task/Task.java
index cee3b77f2..384da36a2 100644
--- a/src/main/java/com/iexec/core/task/Task.java
+++ b/src/main/java/com/iexec/core/task/Task.java
@@ -58,10 +58,6 @@ public class Task {
public static final String CURRENT_STATUS_FIELD_NAME = "currentStatus";
public static final String CONTRIBUTION_DEADLINE_FIELD_NAME = "contributionDeadline";
- /**
- * An XL task timeout happens after 100 hours.
- */
- public static final Duration LONGEST_TASK_TIMEOUT = Duration.ofHours(100);
@Id
private String id;
diff --git a/src/main/java/com/iexec/core/task/TaskRepository.java b/src/main/java/com/iexec/core/task/TaskRepository.java
index 5f799cd01..766014baf 100644
--- a/src/main/java/com/iexec/core/task/TaskRepository.java
+++ b/src/main/java/com/iexec/core/task/TaskRepository.java
@@ -56,13 +56,13 @@ interface TaskRepository extends MongoRepository {
*
*
* @param statuses The task status should be one of this list.
- * @param excludedTag The task tag should not be this tag
+ * @param excludedTags The task tag should not be one this tag list
* - use {@literal null} if no tag should be excluded.
* @param excludedChainTaskIds The chain task ID should not be one of this list.
* @param sort How to prioritize tasks.
* @return The first task matching with the criteria, according to the {@code sort} parameter.
*/
- Optional findFirstByCurrentStatusInAndTagNotAndChainTaskIdNotIn(List statuses, String excludedTag, List excludedChainTaskIds, Sort sort);
+ Optional findFirstByCurrentStatusInAndTagNotInAndChainTaskIdNotIn(List statuses, List excludedTags, List excludedChainTaskIds, Sort sort);
@Query("{ 'currentStatus': {$nin: ?0} }")
List findByCurrentStatusNotIn(List statuses);
diff --git a/src/main/java/com/iexec/core/task/TaskService.java b/src/main/java/com/iexec/core/task/TaskService.java
index 55a04c29e..637ae4564 100644
--- a/src/main/java/com/iexec/core/task/TaskService.java
+++ b/src/main/java/com/iexec/core/task/TaskService.java
@@ -26,10 +26,7 @@
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
+import java.util.*;
import java.util.stream.Collectors;
import static com.iexec.core.task.TaskStatus.*;
@@ -149,19 +146,19 @@ public List findByCurrentStatus(List statusList) {
public Optional getPrioritizedInitializedOrRunningTask(
boolean shouldExcludeTeeTasks,
List excludedChainTaskIds) {
- final String excludedTag = shouldExcludeTeeTasks
- ? TeeUtils.TEE_TAG
+ final List excludedTags = shouldExcludeTeeTasks
+ ? List.of(TeeUtils.TEE_SCONE_ONLY_TAG, TeeUtils.TEE_GRAMINE_ONLY_TAG)
: null;
return findPrioritizedTask(
Arrays.asList(INITIALIZED, RUNNING),
- excludedTag,
+ excludedTags,
excludedChainTaskIds,
Sort.by(Sort.Order.desc(Task.CURRENT_STATUS_FIELD_NAME),
Sort.Order.asc(Task.CONTRIBUTION_DEADLINE_FIELD_NAME)));
}
/**
- * Shortcut for {@link TaskRepository#findFirstByCurrentStatusInAndTagNotAndChainTaskIdNotIn}.
+ * Shortcut for {@link TaskRepository#findFirstByCurrentStatusInAndTagNotInAndChainTaskIdNotIn}.
* Retrieves the prioritized task matching with given criteria:
*
* - Task is in one of given {@code statuses};
@@ -180,12 +177,12 @@ public Optional getPrioritizedInitializedOrRunningTask(
* @return The first task matching with the criteria, according to the {@code sort} parameter.
*/
private Optional findPrioritizedTask(List statuses,
- String excludedTag,
+ List excludedTags,
List excludedChainTaskIds,
Sort sort) {
- return taskRepository.findFirstByCurrentStatusInAndTagNotAndChainTaskIdNotIn(
+ return taskRepository.findFirstByCurrentStatusInAndTagNotInAndChainTaskIdNotIn(
statuses,
- excludedTag,
+ excludedTags,
excludedChainTaskIds,
sort
);
diff --git a/src/main/java/com/iexec/core/task/listener/TaskListeners.java b/src/main/java/com/iexec/core/task/listener/TaskListeners.java
index 7948527d6..a2ee4d0db 100644
--- a/src/main/java/com/iexec/core/task/listener/TaskListeners.java
+++ b/src/main/java/com/iexec/core/task/listener/TaskListeners.java
@@ -16,6 +16,7 @@
package com.iexec.core.task.listener;
+import com.iexec.common.lifecycle.purge.PurgeService;
import com.iexec.common.notification.TaskNotification;
import com.iexec.common.notification.TaskNotificationExtra;
import com.iexec.common.notification.TaskNotificationType;
@@ -43,15 +44,18 @@ public class TaskListeners {
private final NotificationService notificationService;
private final ReplicatesService replicatesService;
private final WorkerService workerService;
+ private final PurgeService purgeService;
public TaskListeners(TaskUpdateRequestManager taskUpdateRequestManager,
NotificationService notificationService,
ReplicatesService replicatesService,
- WorkerService workerService) {
+ WorkerService workerService,
+ PurgeService purgeService) {
this.taskUpdateRequestManager = taskUpdateRequestManager;
this.notificationService = notificationService;
this.replicatesService = replicatesService;
this.workerService = workerService;
+ this.purgeService = purgeService;
}
@@ -163,7 +167,7 @@ public void onTaskCompletedEvent(TaskCompletedEvent event) {
.workersAddress(Collections.emptyList())
.build());
- removeChainTaskIdFromWorkers(chainTaskId);
+ purgeTask(chainTaskId);
}
@EventListener
@@ -177,7 +181,7 @@ public void onTaskFailedEvent(TaskFailedEvent event) {
.workersAddress(Collections.emptyList())
.build());
- removeChainTaskIdFromWorkers(chainTaskId);
+ purgeTask(chainTaskId);
}
@EventListener
@@ -191,13 +195,17 @@ public void onTaskRunningFailedEvent(TaskRunningFailedEvent event) {
.workersAddress(Collections.emptyList())
.build());
- removeChainTaskIdFromWorkers(chainTaskId);
+ purgeTask(chainTaskId);
}
- private void removeChainTaskIdFromWorkers(String chainTaskId) {
+ private void purgeTask(String chainTaskId) {
+ // Remove task from workers
for (Replicate replicate : replicatesService.getReplicates(chainTaskId)) {
workerService.removeChainTaskIdFromWorker(chainTaskId, replicate.getWalletAddress());
}
+
+ // Remove other services in-mem task info
+ purgeService.purgeAllServices(chainTaskId);
}
}
diff --git a/src/main/java/com/iexec/core/task/update/TaskUpdateManager.java b/src/main/java/com/iexec/core/task/update/TaskUpdateManager.java
index 384ca7f00..1169b1a9f 100644
--- a/src/main/java/com/iexec/core/task/update/TaskUpdateManager.java
+++ b/src/main/java/com/iexec/core/task/update/TaskUpdateManager.java
@@ -202,6 +202,13 @@ void received2Initializing(Task task) {
return;
}
+ if (task.isTeeTask() && !smsService.isSmsClientReady(task.getChainDealId(), task.getChainTaskId())) {
+ log.error("Couldn't get SmsClient [chainTaskId: {}]", task.getChainTaskId());
+ updateTaskStatusAndSave(task, INITIALIZE_FAILED);
+ updateTaskStatusAndSave(task, FAILED);
+ return;
+ }
+
blockchainAdapterService
.requestInitialize(task.getChainDealId(), task.getTaskIndex())
.filter(chainTaskId -> chainTaskId.equalsIgnoreCase(task.getChainTaskId()))
diff --git a/src/main/java/com/iexec/core/task/update/TaskUpdateRequestManager.java b/src/main/java/com/iexec/core/task/update/TaskUpdateRequestManager.java
index 1d68612ea..3cda6d4a2 100644
--- a/src/main/java/com/iexec/core/task/update/TaskUpdateRequestManager.java
+++ b/src/main/java/com/iexec/core/task/update/TaskUpdateRequestManager.java
@@ -26,7 +26,7 @@
import java.util.concurrent.*;
import java.util.function.Supplier;
-import static com.iexec.core.task.Task.LONGEST_TASK_TIMEOUT;
+import static com.iexec.common.chain.CategoriesUtils.LONGEST_TASK_TIMEOUT;
/**
* This class is used to perform updates on a task one by one.
diff --git a/src/main/java/com/iexec/core/worker/WorkerController.java b/src/main/java/com/iexec/core/worker/WorkerController.java
index 9bc669edd..23aae3edd 100644
--- a/src/main/java/com/iexec/core/worker/WorkerController.java
+++ b/src/main/java/com/iexec/core/worker/WorkerController.java
@@ -26,7 +26,6 @@
import com.iexec.core.chain.adapter.BlockchainAdapterClientConfig;
import com.iexec.core.configuration.ResultRepositoryConfiguration;
import com.iexec.core.configuration.SessionService;
-import com.iexec.core.configuration.SmsConfiguration;
import com.iexec.core.configuration.WorkerConfiguration;
import com.iexec.core.security.ChallengeService;
import com.iexec.core.security.JwtTokenProvider;
@@ -54,7 +53,6 @@ public class WorkerController {
private final ChallengeService challengeService;
private final WorkerConfiguration workerConfiguration;
private final ResultRepositoryConfiguration resultRepoConfig;
- private final SmsConfiguration smsConfiguration;
private final BlockchainAdapterClientConfig blockchainAdapterClientConfig;
public WorkerController(WorkerService workerService,
@@ -64,7 +62,6 @@ public WorkerController(WorkerService workerService,
ChallengeService challengeService,
WorkerConfiguration workerConfiguration,
ResultRepositoryConfiguration resultRepoConfig,
- SmsConfiguration smsConfiguration,
BlockchainAdapterClientConfig blockchainAdapterClientConfig) {
this.workerService = workerService;
this.chainConfig = chainConfig;
@@ -73,7 +70,6 @@ public WorkerController(WorkerService workerService,
this.challengeService = challengeService;
this.workerConfiguration = workerConfiguration;
this.resultRepoConfig = resultRepoConfig;
- this.smsConfiguration = smsConfiguration;
this.blockchainAdapterClientConfig = blockchainAdapterClientConfig;
}
@@ -153,7 +149,6 @@ public ResponseEntity getPublicConfiguration() {
.blockchainAdapterUrl(blockchainAdapterClientConfig.getUrl())
.schedulerPublicAddress(credentialsService.getCredentials().getAddress())
.resultRepositoryURL(resultRepoConfig.getResultRepositoryURL())
- .smsURL(smsConfiguration.getSmsURL())
.askForReplicatePeriod(workerConfiguration.getAskForReplicatePeriod())
.requiredWorkerVersion(workerConfiguration.getRequiredWorkerVersion())
.build();
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 28c9f76ee..13232969b 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -71,11 +71,6 @@ ipfs:
host: ${IEXEC_IPFS_HOST:127.0.0.1}
port: ${IEXEC_IPFS_PORT:5001}
-sms:
- protocol: ${IEXEC_SMS_PROTOCOL:http}
- host: ${IEXEC_SMS_HOST:localhost}
- port: ${IEXEC_SMS_PORT:13300}
-
management:
server:
port: ${IEXEC_CORE_MANAGEMENT_PORT:13001}
diff --git a/src/test/java/com/iexec/core/chain/SignatureServiceTests.java b/src/test/java/com/iexec/core/chain/SignatureServiceTests.java
index 509a543b3..08b91b57a 100644
--- a/src/test/java/com/iexec/core/chain/SignatureServiceTests.java
+++ b/src/test/java/com/iexec/core/chain/SignatureServiceTests.java
@@ -20,8 +20,6 @@
import com.iexec.common.security.Signature;
import com.iexec.common.utils.BytesUtils;
import com.iexec.common.utils.HashUtils;
-import com.iexec.core.configuration.SmsConfiguration;
-
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -36,7 +34,6 @@
class SignatureServiceTests {
@Mock private CredentialsService credentialsService;
- @Mock private SmsConfiguration smsConfiguration;
@InjectMocks
private SignatureService signatureService;
diff --git a/src/test/java/com/iexec/core/configuration/PurgeConfigurationTests.java b/src/test/java/com/iexec/core/configuration/PurgeConfigurationTests.java
new file mode 100644
index 000000000..48efede64
--- /dev/null
+++ b/src/test/java/com/iexec/core/configuration/PurgeConfigurationTests.java
@@ -0,0 +1,25 @@
+package com.iexec.core.configuration;
+
+import com.iexec.common.lifecycle.purge.PurgeService;
+import com.iexec.common.lifecycle.purge.Purgeable;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.mock;
+
+class PurgeConfigurationTests {
+ final PurgeConfiguration purgeConfiguration = new PurgeConfiguration();
+
+ @Test
+ void createPurgeService() {
+ final List purgeables = List.of(
+ mock(Purgeable.class),
+ mock(Purgeable.class),
+ mock(Purgeable.class)
+ );
+ final PurgeService purgeService = purgeConfiguration.purgeService(purgeables);
+ assertNotNull(purgeService);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/iexec/core/replicate/ReplicateSupplyServiceTests.java b/src/test/java/com/iexec/core/replicate/ReplicateSupplyServiceTests.java
index 17655ddd7..99aa6c650 100644
--- a/src/test/java/com/iexec/core/replicate/ReplicateSupplyServiceTests.java
+++ b/src/test/java/com/iexec/core/replicate/ReplicateSupplyServiceTests.java
@@ -25,6 +25,7 @@
import com.iexec.common.replicate.ReplicateStatusModifier;
import com.iexec.common.replicate.ReplicateStatusUpdate;
import com.iexec.common.task.TaskAbortCause;
+import com.iexec.common.tee.TeeUtils;
import com.iexec.common.utils.BytesUtils;
import com.iexec.common.utils.DateTimeUtils;
import com.iexec.core.chain.SignatureService;
@@ -40,6 +41,7 @@
import org.junit.jupiter.api.Test;
import org.mockito.*;
+import java.lang.reflect.Field;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
@@ -49,9 +51,10 @@
import static com.iexec.common.replicate.ReplicateStatus.*;
import static com.iexec.core.task.TaskStatus.RUNNING;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.*;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.*;
@Slf4j
@@ -66,7 +69,7 @@ class ReplicateSupplyServiceTests {
private final static String DAPP_NAME = "dappName";
private final static String COMMAND_LINE = "commandLine";
private final static String NO_TEE_TAG = BytesUtils.EMPTY_HEX_STRING_32;
- private final static String TEE_TAG = "0x0000000000000000000000000000000000000000000000000000000000000001";
+ private final static String TEE_TAG = TeeUtils.TEE_SCONE_ONLY_TAG; //any supported TEE tag
private final static String ENCLAVE_CHALLENGE = "dummyEnclave";
private final static long maxExecutionTime = 60000;
long workerLastBlock = 12;
@@ -1156,6 +1159,60 @@ void shouldNotTellReplicateToWaitForCompletionSinceItDidNotReveal() {
.updateReplicateStatus(CHAIN_TASK_ID, WALLET_WORKER_1, RECOVERING);
}
+ // region purgeTask
+ @Test
+ void shouldPurgeTaskWhenKnownTask() throws NoSuchFieldException, IllegalAccessException {
+ final Map taskAccessForNewReplicateLocks = getTaskAccessForNewReplicateLocks();
+ taskAccessForNewReplicateLocks.put(CHAIN_TASK_ID, new ReentrantLock());
+
+ assertTrue(replicateSupplyService.purgeTask(CHAIN_TASK_ID));
+ assertThat(taskAccessForNewReplicateLocks).isEmpty();
+ }
+
+ @Test
+ void shouldPurgeTaskWhenUnknownTask() throws NoSuchFieldException, IllegalAccessException {
+ final Map taskAccessForNewReplicateLocks = getTaskAccessForNewReplicateLocks();
+ taskAccessForNewReplicateLocks.put(CHAIN_TASK_ID_2, new ReentrantLock());
+
+ assertTrue(replicateSupplyService.purgeTask(CHAIN_TASK_ID));
+ assertThat(taskAccessForNewReplicateLocks).containsOnlyKeys(CHAIN_TASK_ID_2);
+ }
+
+ @Test
+ void shouldPurgeTaskWhenEmpty() throws NoSuchFieldException, IllegalAccessException {
+ final Map taskAccessForNewReplicateLocks = getTaskAccessForNewReplicateLocks();
+
+ assertTrue(replicateSupplyService.purgeTask(CHAIN_TASK_ID));
+ assertThat(taskAccessForNewReplicateLocks).isEmpty();
+ }
+
+ private Map getTaskAccessForNewReplicateLocks() throws NoSuchFieldException, IllegalAccessException {
+ final Field field = ReplicateSupplyService.class.getDeclaredField("taskAccessForNewReplicateLocks");
+ field.setAccessible(true);
+ return (Map) field.get(replicateSupplyService);
+ }
+ // endregion
+
+ // region purgeAllTasksData
+ @Test
+ void shouldPurgeAllTasksDataWhenEmpty() throws NoSuchFieldException, IllegalAccessException {
+ final Map taskAccessForNewReplicateLocks = getTaskAccessForNewReplicateLocks();
+
+ replicateSupplyService.purgeAllTasksData();
+ assertThat(taskAccessForNewReplicateLocks).isEmpty();
+ }
+
+ @Test
+ void shouldPurgeAllTasksDataWhenFull() throws NoSuchFieldException, IllegalAccessException {
+ final Map taskAccessForNewReplicateLocks = getTaskAccessForNewReplicateLocks();
+ taskAccessForNewReplicateLocks.put(CHAIN_TASK_ID, new ReentrantLock());
+ taskAccessForNewReplicateLocks.put(CHAIN_TASK_ID_2, new ReentrantLock());
+
+ replicateSupplyService.purgeAllTasksData();
+ assertThat(taskAccessForNewReplicateLocks).isEmpty();
+ }
+ // endregion
+
List getStubTaskList(TaskStatus status) {
Task task = Task.builder()
.chainTaskId(CHAIN_TASK_ID)
diff --git a/src/test/java/com/iexec/core/sms/SmsServiceTests.java b/src/test/java/com/iexec/core/sms/SmsServiceTests.java
index d1b9a8c63..1a17886c5 100644
--- a/src/test/java/com/iexec/core/sms/SmsServiceTests.java
+++ b/src/test/java/com/iexec/core/sms/SmsServiceTests.java
@@ -1,7 +1,13 @@
package com.iexec.core.sms;
+import com.iexec.common.chain.ChainDeal;
+import com.iexec.common.chain.IexecHubAbstractService;
+import com.iexec.common.task.TaskDescription;
+import com.iexec.common.tee.TeeEnclaveProvider;
import com.iexec.common.utils.BytesUtils;
import com.iexec.sms.api.SmsClient;
+import com.iexec.sms.api.SmsClientCreationException;
+import com.iexec.sms.api.SmsClientProvider;
import feign.FeignException;
import feign.Request;
import org.assertj.core.api.Assertions;
@@ -14,15 +20,31 @@
import java.util.Collections;
import java.util.Optional;
+import static com.iexec.common.tee.TeeUtils.TEE_GRAMINE_ONLY_TAG;
import static org.mockito.Mockito.*;
class SmsServiceTests {
+ private static final String CHAIN_DEAL_ID = "chainDealId";
private static final String CHAIN_TASK_ID = "chainTaskId";
+ private static final ChainDeal CHAIN_DEAL = ChainDeal
+ .builder()
+ .chainDealId(CHAIN_DEAL_ID)
+ .tag(TEE_GRAMINE_ONLY_TAG)
+ .build();
+ private static final TaskDescription TASK_DESCRIPTION = TaskDescription
+ .builder()
+ .chainTaskId(CHAIN_TASK_ID)
+ .build();
@Mock
private SmsClient smsClient;
+ @Mock
+ private SmsClientProvider smsClientProvider;
+ @Mock
+ private IexecHubAbstractService iexecHubService;
+
@InjectMocks
private SmsService smsService;
@@ -31,8 +53,70 @@ void init() {
MockitoAnnotations.openMocks(this);
}
+ // region isSmsClientReady
+ @Test
+ void smsClientShouldBeReady() {
+ when(iexecHubService.getChainDeal(CHAIN_DEAL_ID)).thenReturn(Optional.of(CHAIN_DEAL));
+ when(smsClientProvider.getOrCreateSmsClientForUninitializedTask(CHAIN_DEAL, CHAIN_TASK_ID)).thenReturn(smsClient);
+ when(smsClient.getTeeEnclaveProvider()).thenReturn(TeeEnclaveProvider.GRAMINE);
+
+ Assertions.assertThat(smsService.isSmsClientReady(CHAIN_DEAL_ID, CHAIN_TASK_ID)).isTrue();
+
+ verify(smsClientProvider).getOrCreateSmsClientForUninitializedTask(CHAIN_DEAL, CHAIN_TASK_ID);
+ verify(smsClient).getTeeEnclaveProvider();
+ }
+
+ @Test
+ void smsClientShouldBeNotReadySinceNoChainDeal() {
+ when(iexecHubService.getChainDeal(CHAIN_DEAL_ID)).thenReturn(Optional.empty());
+
+ Assertions.assertThat(smsService.isSmsClientReady(CHAIN_DEAL_ID, CHAIN_TASK_ID)).isFalse();
+
+ verify(smsClientProvider, times(0)).getOrCreateSmsClientForUninitializedTask(CHAIN_DEAL, CHAIN_TASK_ID);
+ verify(smsClient, times(0)).getTeeEnclaveProvider();
+ }
+
+ @Test
+ void smsClientShouldBeNotReadySinceCantBeCreated() {
+ when(iexecHubService.getChainDeal(CHAIN_DEAL_ID)).thenReturn(Optional.of(CHAIN_DEAL));
+ when(smsClientProvider.getOrCreateSmsClientForUninitializedTask(CHAIN_DEAL, CHAIN_TASK_ID)).thenThrow(SmsClientCreationException.class);
+
+ Assertions.assertThat(smsService.isSmsClientReady(CHAIN_DEAL_ID, CHAIN_TASK_ID)).isFalse();
+
+ verify(smsClientProvider).getOrCreateSmsClientForUninitializedTask(CHAIN_DEAL, CHAIN_TASK_ID);
+ verify(smsClient, times(0)).getTeeEnclaveProvider();
+ }
+
+ @Test
+ void smsClientShouldBeNotReadySinceCantRetrieveTeeEnclaveProvider() {
+ when(iexecHubService.getChainDeal(CHAIN_DEAL_ID)).thenReturn(Optional.of(CHAIN_DEAL));
+ when(smsClientProvider.getOrCreateSmsClientForUninitializedTask(CHAIN_DEAL, CHAIN_TASK_ID)).thenReturn(smsClient);
+ when(smsClient.getTeeEnclaveProvider()).thenThrow(mock(FeignException.class));
+
+ Assertions.assertThat(smsService.isSmsClientReady(CHAIN_DEAL_ID, CHAIN_TASK_ID)).isFalse();
+
+ verify(smsClientProvider).getOrCreateSmsClientForUninitializedTask(CHAIN_DEAL, CHAIN_TASK_ID);
+ verify(smsClient).getTeeEnclaveProvider();
+ }
+
+ @Test
+ void smsClientShouldBeNotReadySinceWrongTeeEnclaveProvider() {
+ when(iexecHubService.getChainDeal(CHAIN_DEAL_ID)).thenReturn(Optional.of(CHAIN_DEAL));
+ when(smsClientProvider.getOrCreateSmsClientForUninitializedTask(CHAIN_DEAL, CHAIN_TASK_ID)).thenReturn(smsClient);
+ when(smsClient.getTeeEnclaveProvider()).thenReturn(TeeEnclaveProvider.SCONE);
+
+ Assertions.assertThat(smsService.isSmsClientReady(CHAIN_DEAL_ID, CHAIN_TASK_ID)).isFalse();
+
+ verify(smsClientProvider).getOrCreateSmsClientForUninitializedTask(CHAIN_DEAL, CHAIN_TASK_ID);
+ verify(smsClient).getTeeEnclaveProvider();
+ }
+ // endregion
+
+ // region getEnclaveChallenge
@Test
void shouldGetEmptyAddressForStandardTask() {
+ when(iexecHubService.getTaskDescription(CHAIN_TASK_ID)).thenReturn(TASK_DESCRIPTION);
+ when(smsClientProvider.getOrCreateSmsClientForTask(TASK_DESCRIPTION)).thenReturn(smsClient);
Assertions.assertThat(smsService.getEnclaveChallenge(CHAIN_TASK_ID, false))
.get()
.isEqualTo(BytesUtils.EMPTY_ADDRESS);
@@ -42,6 +126,8 @@ void shouldGetEmptyAddressForStandardTask() {
@Test
void shouldGetEnclaveChallengeForTeeTask() {
String expected = "challenge";
+ when(iexecHubService.getTaskDescription(CHAIN_TASK_ID)).thenReturn(TASK_DESCRIPTION);
+ when(smsClientProvider.getOrCreateSmsClientForTask(TASK_DESCRIPTION)).thenReturn(smsClient);
when(smsClient.generateTeeChallenge(CHAIN_TASK_ID)).thenReturn(expected);
Optional received = smsService.getEnclaveChallenge(CHAIN_TASK_ID, true);
@@ -53,6 +139,8 @@ void shouldGetEnclaveChallengeForTeeTask() {
@Test
void shouldNotGetEnclaveChallengeForTeeTaskWhenEmptySmsResponse() {
+ when(iexecHubService.getTaskDescription(CHAIN_TASK_ID)).thenReturn(TASK_DESCRIPTION);
+ when(smsClientProvider.getOrCreateSmsClientForTask(TASK_DESCRIPTION)).thenReturn(smsClient);
when(smsClient.generateTeeChallenge(CHAIN_TASK_ID)).thenReturn("");
Optional received = smsService.getEnclaveChallenge(CHAIN_TASK_ID, true);
verify(smsClient).generateTeeChallenge(CHAIN_TASK_ID);
@@ -61,15 +149,21 @@ void shouldNotGetEnclaveChallengeForTeeTaskWhenEmptySmsResponse() {
@Test
void shouldNotGetEnclaveChallengeForTeeTaskWhenNullSmsResponse() {
+ when(iexecHubService.getTaskDescription(CHAIN_TASK_ID)).thenReturn(TASK_DESCRIPTION);
+ when(smsClientProvider.getOrCreateSmsClientForTask(TASK_DESCRIPTION)).thenReturn(smsClient);
when(smsClient.generateTeeChallenge(CHAIN_TASK_ID)).thenReturn(null);
Optional received = smsService.getEnclaveChallenge(CHAIN_TASK_ID, true);
verify(smsClient).generateTeeChallenge(CHAIN_TASK_ID);
Assertions.assertThat(received).isEmpty();
}
+ // endregion
+ // region generateEnclaveChallenge
@Test
void shouldNotGetEnclaveChallengeOnFeignException() {
+ when(iexecHubService.getTaskDescription(CHAIN_TASK_ID)).thenReturn(TASK_DESCRIPTION);
+ when(smsClientProvider.getOrCreateSmsClientForTask(TASK_DESCRIPTION)).thenReturn(smsClient);
Request request = Request.create(Request.HttpMethod.HEAD, "http://localhost",
Collections.emptyMap(), Request.Body.empty(), null);
Assertions.assertThat(smsService.generateEnclaveChallenge(
@@ -79,4 +173,5 @@ void shouldNotGetEnclaveChallengeOnFeignException() {
).isEmpty();
verifyNoInteractions(smsClient);
}
+ // endregion
}
\ No newline at end of file
diff --git a/src/test/java/com/iexec/core/task/TaskModelTests.java b/src/test/java/com/iexec/core/task/TaskModelTests.java
index c4634da4d..74d63704a 100644
--- a/src/test/java/com/iexec/core/task/TaskModelTests.java
+++ b/src/test/java/com/iexec/core/task/TaskModelTests.java
@@ -17,7 +17,6 @@
package com.iexec.core.task;
import com.iexec.common.dapp.DappType;
-import com.iexec.common.tee.TeeUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -29,7 +28,7 @@ class TaskModelTests {
public static final String CHAIN_TASK_ID = "task";
public static final long MAX_EXECUTION_TIME = 1;
- public static final String TAG = TeeUtils.TEE_TAG;
+ public static final String TAG = "0xa";
public static final DappType DAPP_TYPE = DappType.DOCKER;
public static final String DAPP_NAME = "name";
public static final String COMMAND_LINE = "line";
diff --git a/src/test/java/com/iexec/core/task/TaskServiceTests.java b/src/test/java/com/iexec/core/task/TaskServiceTests.java
index 41dcef919..e047222ca 100644
--- a/src/test/java/com/iexec/core/task/TaskServiceTests.java
+++ b/src/test/java/com/iexec/core/task/TaskServiceTests.java
@@ -161,7 +161,7 @@ void shouldNotFindByCurrentStatusList() {
@Test
void shouldGetInitializedOrRunningTasks() {
Task task = mock(Task.class);
- when(taskRepository.findFirstByCurrentStatusInAndTagNotAndChainTaskIdNotIn(
+ when(taskRepository.findFirstByCurrentStatusInAndTagNotInAndChainTaskIdNotIn(
eq(Arrays.asList(INITIALIZED, RUNNING)),
any(),
eq(Collections.emptyList()),
diff --git a/src/test/java/com/iexec/core/task/TaskTestsUtils.java b/src/test/java/com/iexec/core/task/TaskTestsUtils.java
index c2458591c..769a71a31 100644
--- a/src/test/java/com/iexec/core/task/TaskTestsUtils.java
+++ b/src/test/java/com/iexec/core/task/TaskTestsUtils.java
@@ -16,6 +16,7 @@
package com.iexec.core.task;
+import com.iexec.common.tee.TeeUtils;
import com.iexec.common.utils.BytesUtils;
import java.time.Instant;
@@ -32,7 +33,7 @@ public class TaskTestsUtils {
public final static String DAPP_NAME = "dappName";
public final static String COMMAND_LINE = "commandLine";
public final static String NO_TEE_TAG = BytesUtils.EMPTY_HEX_STRING_32;
- public final static String TEE_TAG = "0x0000000000000000000000000000000000000000000000000000000000000001";
+ public final static String TEE_TAG = TeeUtils.TEE_SCONE_ONLY_TAG; //any supported TEE tag
public final static String RESULT_LINK = "/ipfs/the_result_string";
public static Task getStubTask(long maxExecutionTime) {
diff --git a/src/test/java/com/iexec/core/task/listener/TaskListenerTest.java b/src/test/java/com/iexec/core/task/listener/TaskListenerTest.java
index c4963f322..5c3b98bc9 100644
--- a/src/test/java/com/iexec/core/task/listener/TaskListenerTest.java
+++ b/src/test/java/com/iexec/core/task/listener/TaskListenerTest.java
@@ -19,6 +19,7 @@
import com.iexec.common.notification.TaskNotification;
import com.iexec.common.notification.TaskNotificationType;
import com.iexec.common.task.TaskAbortCause;
+import com.iexec.common.lifecycle.purge.PurgeService;
import com.iexec.core.pubsub.NotificationService;
import com.iexec.core.replicate.Replicate;
import com.iexec.core.replicate.ReplicatesService;
@@ -55,6 +56,8 @@ class TaskListenerTest {
private ReplicatesService replicatesService;
@Mock
private WorkerService workerService;
+ @Mock
+ private PurgeService purgeService;
@InjectMocks
private TaskListeners taskListeners;
@@ -160,6 +163,7 @@ void onTaskCompletedEvent() {
taskListeners.onTaskCompletedEvent(event);
verify(notificationService).sendTaskNotification(any());
verify(workerService).removeChainTaskIdFromWorker(CHAIN_TASK_ID, WALLET1);
+ verify(purgeService).purgeAllServices(CHAIN_TASK_ID);
// TODO capture args
}
@@ -177,6 +181,7 @@ void onTaskFailedEvent() {
.build()
);
verify(workerService).removeChainTaskIdFromWorker(CHAIN_TASK_ID, WALLET1);
+ verify(purgeService).purgeAllServices(CHAIN_TASK_ID);
}
@Test
@@ -193,5 +198,6 @@ void onTaskRunningFailedEvent() {
.build()
);
verify(workerService).removeChainTaskIdFromWorker(CHAIN_TASK_ID, WALLET1);
+ verify(purgeService).purgeAllServices(CHAIN_TASK_ID);
}
}
diff --git a/src/test/java/com/iexec/core/task/update/TaskUpdateManagerTest.java b/src/test/java/com/iexec/core/task/update/TaskUpdateManagerTest.java
index 4853433eb..6c5b383f9 100644
--- a/src/test/java/com/iexec/core/task/update/TaskUpdateManagerTest.java
+++ b/src/test/java/com/iexec/core/task/update/TaskUpdateManagerTest.java
@@ -32,16 +32,19 @@
import com.iexec.core.replicate.Replicate;
import com.iexec.core.replicate.ReplicatesList;
import com.iexec.core.replicate.ReplicatesService;
+import com.iexec.core.sms.SmsService;
import com.iexec.core.task.Task;
import com.iexec.core.task.TaskService;
import com.iexec.core.task.TaskStatus;
-import com.iexec.core.sms.SmsService;
import com.iexec.core.task.event.PleaseUploadEvent;
import com.iexec.core.worker.Worker;
import com.iexec.core.worker.WorkerService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.mockito.*;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
import org.springframework.context.ApplicationEventPublisher;
import java.time.Instant;
@@ -307,6 +310,25 @@ void shouldNotUpdateReceived2InitializingSinceAfterContributionDeadline() {
assertThat(task.getCurrentStatus()).isEqualTo(RECEIVED);
}
+ @Test
+ void shouldNotUpdateReceived2InitializingSinceNoSmsClient() {
+ Task task = getStubTask(maxExecutionTime);
+ task.changeStatus(RECEIVED);
+ task.setChainTaskId(CHAIN_TASK_ID);
+
+ when(taskService.getTaskByChainTaskId(CHAIN_TASK_ID)).thenReturn(Optional.of(task));
+ when(iexecHubService.hasEnoughGas()).thenReturn(true);
+ when(iexecHubService.isTaskInUnsetStatusOnChain(CHAIN_DEAL_ID, 0)).thenReturn(true);
+ when(iexecHubService.isBeforeContributionDeadline(task.getChainDealId()))
+ .thenReturn(true);
+ when(taskService.updateTask(task)).thenReturn(Optional.of(task));
+ when(blockchainAdapterService.requestInitialize(CHAIN_DEAL_ID, 0)).thenReturn(Optional.of(CHAIN_TASK_ID));
+ when(smsService.isSmsClientReady(CHAIN_DEAL_ID, CHAIN_TASK_ID)).thenReturn(false);
+
+ taskUpdateManager.updateTask(CHAIN_TASK_ID);
+ assertThat(task.getCurrentStatus()).isEqualTo(FAILED);
+ }
+
@Test
void shouldUpdateInitializing2InitailizeFailedSinceChainTaskIdIsEmpty() {
Task task = getStubTask(maxExecutionTime);
diff --git a/src/test/java/com/iexec/core/worker/WorkerControllerTests.java b/src/test/java/com/iexec/core/worker/WorkerControllerTests.java
index b5a928ae7..e1f1084de 100644
--- a/src/test/java/com/iexec/core/worker/WorkerControllerTests.java
+++ b/src/test/java/com/iexec/core/worker/WorkerControllerTests.java
@@ -6,7 +6,6 @@
import com.iexec.core.chain.CredentialsService;
import com.iexec.core.chain.adapter.BlockchainAdapterClientConfig;
import com.iexec.core.configuration.ResultRepositoryConfiguration;
-import com.iexec.core.configuration.SmsConfiguration;
import com.iexec.core.configuration.WorkerConfiguration;
import com.iexec.core.security.ChallengeService;
import com.iexec.core.security.JwtTokenProvider;
@@ -59,8 +58,6 @@ class WorkerControllerTests {
@Mock
private ResultRepositoryConfiguration resultRepoConfig;
@Mock
- private SmsConfiguration smsConfiguration;
- @Mock
private BlockchainAdapterClientConfig blockchainAdapterClientConfig;
@InjectMocks