fix(接口测试): 修复k8s执行环境校验问题修复
This commit is contained in:
parent
e9641c5483
commit
a3561988b0
|
@ -31,7 +31,6 @@ import org.apache.jmeter.visualizers.backend.BackendListener;
|
|||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
@ -51,8 +50,6 @@ public class JMeterService {
|
|||
@Resource
|
||||
private TestResourcePoolMapper testResourcePoolMapper;
|
||||
@Resource
|
||||
private KafkaTemplate<String, Object> kafkaTemplate;
|
||||
@Resource
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@PostConstruct
|
||||
|
|
|
@ -78,7 +78,7 @@ public class ResourcePoolCalculation {
|
|||
public List<JvmInfoDTO> getPools(String resourcePoolId) {
|
||||
// 获取可以执行的资源池
|
||||
TestResourcePoolExample example = new TestResourcePoolExample();
|
||||
example.createCriteria().andStatusEqualTo("VALID").andIdEqualTo(resourcePoolId);
|
||||
example.createCriteria().andStatusEqualTo("VALID").andTypeEqualTo("NODE").andIdEqualTo(resourcePoolId);
|
||||
List<TestResourcePool> pools = testResourcePoolMapper.selectByExample(example);
|
||||
|
||||
// 按照NODE节点的可用内存空间大小排序
|
||||
|
|
|
@ -144,6 +144,8 @@ public class ApiAutomationService {
|
|||
private RelationshipEdgeService relationshipEdgeService;
|
||||
@Resource
|
||||
private ApiScenarioFollowMapper apiScenarioFollowMapper;
|
||||
@Resource
|
||||
private TestResourcePoolMapper testResourcePoolMapper;
|
||||
|
||||
private ThreadLocal<Long> currentScenarioOrder = new ThreadLocal<>();
|
||||
|
||||
|
@ -1058,11 +1060,16 @@ public class ApiAutomationService {
|
|||
}
|
||||
// 资源池
|
||||
if (request.getConfig() != null && StringUtils.isNotEmpty(request.getConfig().getResourcePoolId())) {
|
||||
List<JvmInfoDTO> testResources = resourcePoolCalculation.getPools(request.getConfig().getResourcePoolId());
|
||||
request.getConfig().setTestResources(testResources);
|
||||
String status = nodeKafkaService.createKafkaProducer(request.getConfig());
|
||||
if ("ERROR".equals(status)) {
|
||||
MSException.throwException("执行节点的kafka 启动失败,无法执行");
|
||||
TestResourcePool pool = testResourcePoolMapper.selectByPrimaryKey(request.getConfig().getResourcePoolId());
|
||||
if (pool != null && pool.getApi() && pool.getType().equals(ResourcePoolTypeEnum.K8S.name())) {
|
||||
LogUtil.info("K8S 暂时不做校验 ");
|
||||
} else {
|
||||
List<JvmInfoDTO> testResources = resourcePoolCalculation.getPools(request.getConfig().getResourcePoolId());
|
||||
request.getConfig().setTestResources(testResources);
|
||||
String status = nodeKafkaService.createKafkaProducer(request.getConfig());
|
||||
if ("ERROR".equals(status)) {
|
||||
MSException.throwException("执行节点的kafka 启动失败,无法执行");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 环境检查
|
||||
|
|
Loading…
Reference in New Issue