提交 7cd5d8c6 编写于 作者: C Captain.B

refactor: 性能测试执行前检查资源池的状态

上级 1c385a99
......@@ -76,6 +76,8 @@ public class PerformanceTestService {
private TestCaseService testCaseService;
@Resource
private PerformanceNoticeTask performanceNoticeTask;
@Resource
private TestResourcePoolMapper testResourcePoolMapper;
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
......@@ -217,6 +219,14 @@ public class PerformanceTestService {
if (StringUtils.equalsAny(loadTest.getStatus(), PerformanceTestStatus.Running.name(), PerformanceTestStatus.Starting.name())) {
MSException.throwException(Translator.get("load_test_is_running"));
}
String testResourcePoolId = loadTest.getTestResourcePoolId();
TestResourcePool testResourcePool = testResourcePoolMapper.selectByPrimaryKey(testResourcePoolId);
if (testResourcePool == null) {
MSException.throwException("Test resource pool not exists.");
}
if (ResourceStatusEnum.INVALID.name().equals(testResourcePool.getStatus())) {
MSException.throwException("Test resource pool invalid.");
}
// check kafka
checkKafka();
......@@ -479,9 +489,9 @@ public class PerformanceTestService {
quotaService.checkLoadTestQuota(request, create);
}
}
public List<LoadTest> getLoadTestListByIds(List<String> ids) {
if (CollectionUtils.isEmpty(ids)) {
if (CollectionUtils.isEmpty(ids)) {
return new ArrayList<>();
}
LoadTestExample loadTestExample = new LoadTestExample();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册