diff --git a/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java b/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java index 445397e32a..b0204397ad 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java @@ -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 kafkaTemplate; - @Resource private RestTemplate restTemplate; @PostConstruct diff --git a/backend/src/main/java/io/metersphere/api/jmeter/ResourcePoolCalculation.java b/backend/src/main/java/io/metersphere/api/jmeter/ResourcePoolCalculation.java index f62042ae3b..c1e8ff7eff 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/ResourcePoolCalculation.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/ResourcePoolCalculation.java @@ -78,7 +78,7 @@ public class ResourcePoolCalculation { public List getPools(String resourcePoolId) { // 获取可以执行的资源池 TestResourcePoolExample example = new TestResourcePoolExample(); - example.createCriteria().andStatusEqualTo("VALID").andIdEqualTo(resourcePoolId); + example.createCriteria().andStatusEqualTo("VALID").andTypeEqualTo("NODE").andIdEqualTo(resourcePoolId); List pools = testResourcePoolMapper.selectByExample(example); // 按照NODE节点的可用内存空间大小排序 diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 81c0655226..6febfcf1e6 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -144,6 +144,8 @@ public class ApiAutomationService { private RelationshipEdgeService relationshipEdgeService; @Resource private ApiScenarioFollowMapper apiScenarioFollowMapper; + @Resource + private TestResourcePoolMapper testResourcePoolMapper; private ThreadLocal currentScenarioOrder = new ThreadLocal<>(); @@ -1058,11 +1060,16 @@ public class ApiAutomationService { } // 资源池 if (request.getConfig() != null && StringUtils.isNotEmpty(request.getConfig().getResourcePoolId())) { - List 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 testResources = resourcePoolCalculation.getPools(request.getConfig().getResourcePoolId()); + request.getConfig().setTestResources(testResources); + String status = nodeKafkaService.createKafkaProducer(request.getConfig()); + if ("ERROR".equals(status)) { + MSException.throwException("执行节点的kafka 启动失败,无法执行"); + } } } // 环境检查