refactor(测试计划): 优化测试计划单独执行的方法
This commit is contained in:
parent
59ee108a09
commit
6ebb9148e5
|
@ -127,26 +127,30 @@ public class TestPlanExecuteService {
|
|||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.NOT_SUPPORTED)
|
||||
public String singleExecuteTestPlan(TestPlanExecuteRequest request, String userId) {
|
||||
|
||||
String queueId = IDGenerator.nextStr();
|
||||
TestPlanExecutionQueue singleExecuteRootQueue = new TestPlanExecutionQueue(
|
||||
0,
|
||||
userId,
|
||||
System.currentTimeMillis(),
|
||||
queueId,
|
||||
QUEUE_PREFIX_TEST_PLAN_BATCH_EXECUTE,
|
||||
null,
|
||||
null,
|
||||
request.getExecuteId(),
|
||||
request.getRunMode(),
|
||||
request.getExecutionSource(),
|
||||
IDGenerator.nextStr()
|
||||
);
|
||||
String reportId = IDGenerator.nextStr();
|
||||
Thread.startVirtualThread(() -> {
|
||||
String queueId = IDGenerator.nextStr();
|
||||
TestPlanExecutionQueue singleExecuteRootQueue = new TestPlanExecutionQueue(
|
||||
0,
|
||||
userId,
|
||||
System.currentTimeMillis(),
|
||||
queueId,
|
||||
QUEUE_PREFIX_TEST_PLAN_BATCH_EXECUTE,
|
||||
null,
|
||||
null,
|
||||
request.getExecuteId(),
|
||||
request.getRunMode(),
|
||||
request.getExecutionSource(),
|
||||
reportId
|
||||
);
|
||||
|
||||
testPlanExecuteSupportService.setRedisForList(
|
||||
testPlanExecuteSupportService.genQueueKey(queueId, QUEUE_PREFIX_TEST_PLAN_BATCH_EXECUTE), List.of(JSON.toJSONString(singleExecuteRootQueue)));
|
||||
TestPlanExecutionQueue nextQueue = testPlanExecuteSupportService.getNextQueue(queueId, QUEUE_PREFIX_TEST_PLAN_BATCH_EXECUTE);
|
||||
LogUtils.info("测试计划(组)的单独执行start!计划报告[{}] , 资源ID[{}]", singleExecuteRootQueue.getPrepareReportId(), singleExecuteRootQueue.getSourceID());
|
||||
return executeTestPlanOrGroup(nextQueue);
|
||||
testPlanExecuteSupportService.setRedisForList(
|
||||
testPlanExecuteSupportService.genQueueKey(queueId, QUEUE_PREFIX_TEST_PLAN_BATCH_EXECUTE), List.of(JSON.toJSONString(singleExecuteRootQueue)));
|
||||
TestPlanExecutionQueue nextQueue = testPlanExecuteSupportService.getNextQueue(queueId, QUEUE_PREFIX_TEST_PLAN_BATCH_EXECUTE);
|
||||
LogUtils.info("测试计划(组)的单独执行start!计划报告[{}] , 资源ID[{}]", singleExecuteRootQueue.getPrepareReportId(), singleExecuteRootQueue.getSourceID());
|
||||
executeTestPlanOrGroup(nextQueue);
|
||||
});
|
||||
return reportId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -282,6 +282,8 @@ public class TestPlanExecuteTests extends BaseTest {
|
|||
|
||||
this.requestPostWithOk(URL_POST_TEST_PLAN_SINGLE_EXECUTE, executeRequest);
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
//检查队列
|
||||
List<String> allQueueIds = new ArrayList<>();
|
||||
List<String> collectionQueueIdList = new ArrayList<>();
|
||||
|
|
Loading…
Reference in New Issue