fix(接口测试): k8s设置单任务并发数

This commit is contained in:
AgAngle 2024-10-21 16:39:16 +08:00 committed by Craftsman
parent d8ceb22bb6
commit a1be77e885

View File

@ -233,6 +233,7 @@ public class ApiExecuteService {
if (isK8SResourcePool) { if (isK8SResourcePool) {
TestResourceDTO testResourceDTO = new TestResourceDTO(); TestResourceDTO testResourceDTO = new TestResourceDTO();
BeanUtils.copyBean(testResourceDTO, testResourcePoolDTO.getTestResourceReturnDTO()); BeanUtils.copyBean(testResourceDTO, testResourcePoolDTO.getTestResourceReturnDTO());
taskInfo.setPerTaskSize(testResourceDTO.getPodThreads());
taskInfo.setPoolSize(testResourceDTO.getConcurrentNumber()); taskInfo.setPoolSize(testResourceDTO.getConcurrentNumber());
LogUtils.info("开始发送请求【 {}_{} 】到 K8S 资源池执行", taskItem.getReportId(), taskItem.getResourceId()); LogUtils.info("开始发送请求【 {}_{} 】到 K8S 资源池执行", taskItem.getReportId(), taskItem.getResourceId());
if (isDebugMode) { if (isDebugMode) {
@ -315,6 +316,7 @@ public class ApiExecuteService {
TestResourceDTO testResourceDTO = new TestResourceDTO(); TestResourceDTO testResourceDTO = new TestResourceDTO();
BeanUtils.copyBean(testResourceDTO, testResourcePool.getTestResourceReturnDTO()); BeanUtils.copyBean(testResourceDTO, testResourcePool.getTestResourceReturnDTO());
taskInfo.setPoolSize(testResourceDTO.getConcurrentNumber()); taskInfo.setPoolSize(testResourceDTO.getConcurrentNumber());
taskInfo.setPerTaskSize(testResourceDTO.getPodThreads());
try { try {
EngineFactory.batchRunApi(taskRequest, testResourceDTO); EngineFactory.batchRunApi(taskRequest, testResourceDTO);
} catch (Exception e) { } catch (Exception e) {
@ -337,6 +339,7 @@ public class ApiExecuteService {
} else { } else {
distributeTask = distributeTasks.get(nodeIndex); distributeTask = distributeTasks.get(nodeIndex);
} }
taskInfo.setPerTaskSize(Optional.ofNullable(nodesList.get(nodeIndex).getSingleTaskConcurrentNumber()).orElse(3));
distributeTask.getTaskInfo().setPoolSize(nodesList.get(nodeIndex).getConcurrentNumber()); distributeTask.getTaskInfo().setPoolSize(nodesList.get(nodeIndex).getConcurrentNumber());
distributeTask.getTaskItems().add(taskRequest.getTaskItems().get(i)); distributeTask.getTaskItems().add(taskRequest.getTaskItems().get(i));
} }