refactor(接口测试): 优化local资源池被禁选择资源池的逻辑

This commit is contained in:
wxg0103 2023-06-01 17:57:38 +08:00 committed by fit2-zhao
parent 07b9584d71
commit efa9beee89

View File

@ -91,11 +91,14 @@ public class ApiPoolDebugService {
if (!contains) {
List<TestResourcePoolDTO> pools = poolList.stream().filter(pool ->
StringUtils.equals(pool.getName(), "LOCAL")).collect(Collectors.toList());
StringUtils.equals(pool.getName(), "LOCAL") &&
!StringUtils.equals(config.getResourcePoolId(),pool.getId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(pools)) {
config.setResourcePoolId(pools.get(0).getId());
} else {
config.setResourcePoolId(poolList.get(0).getId());
List<TestResourcePoolDTO> other = poolList.stream().filter(pool ->
!StringUtils.equals(config.getResourcePoolId() ,pool.getId())).collect(Collectors.toList());
config.setResourcePoolId(other.get(0).getId());
}
}