From 096aa323581c2e79df565584a93d440b33ebc1bb Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 28 Oct 2021 10:54:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=A8=E4=BE=8Bk8s=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=A0=A1=E9=AA=8C=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/service/TestPlanApiCaseService.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java index 2d872d0d7e..6150ec428a 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java @@ -29,15 +29,9 @@ import io.metersphere.api.service.ApiDefinitionExecResultService; import io.metersphere.api.service.ApiTestCaseService; import io.metersphere.api.service.NodeKafkaService; import io.metersphere.base.domain.*; -import io.metersphere.base.mapper.ApiDefinitionExecResultMapper; -import io.metersphere.base.mapper.ApiTestCaseMapper; -import io.metersphere.base.mapper.TestPlanApiCaseMapper; -import io.metersphere.base.mapper.TestPlanMapper; +import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtTestPlanApiCaseMapper; -import io.metersphere.commons.constants.APITestStatus; -import io.metersphere.commons.constants.ApiRunMode; -import io.metersphere.commons.constants.RunModeConstants; -import io.metersphere.commons.constants.TriggerMode; +import io.metersphere.commons.constants.*; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.*; import io.metersphere.controller.request.ResetOrderRequest; @@ -97,6 +91,8 @@ public class TestPlanApiCaseService { private ResourcePoolCalculation resourcePoolCalculation; @Resource private NodeKafkaService nodeKafkaService; + @Resource + private TestResourcePoolMapper testResourcePoolMapper; public TestPlanApiCase getInfo(String caseId, String testPlanId) { TestPlanApiCaseExample example = new TestPlanApiCaseExample(); @@ -400,11 +396,16 @@ public class TestPlanApiCaseService { ApiDefinitionExecResultMapper batchMapper = sqlSession.getMapper(ApiDefinitionExecResultMapper.class); // 资源池 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 启动失败,无法执行"); + } } } // 开始选择执行模式