refactor(测试跟踪): 测试计划执行时,禁止删除
【【测试跟踪】正在执行的计划,批量删除也成功了】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001020150
This commit is contained in:
parent
bf45160521
commit
fb291ba2f8
|
@ -8,4 +8,6 @@ public interface ExtTestPlanReportContentMapper {
|
|||
boolean isDynamicallyGenerateReport(@Param("reportId") String reportId);
|
||||
|
||||
TestPlanReportContentWithBLOBs selectForPassRate(@Param("reportId") String reportId);
|
||||
|
||||
boolean hasRunningReport(@Param("planId") String planId);
|
||||
}
|
||||
|
|
|
@ -23,4 +23,9 @@
|
|||
from test_plan_report_content
|
||||
where test_plan_report_id = #{reportId}
|
||||
</select>
|
||||
<select id="hasRunningReport" resultType="java.lang.Boolean">
|
||||
select count(1) > 0 from test_plan_report
|
||||
where test_plan_id = #{planId} and status = 'RUNNING'
|
||||
order by create_time desc limit 1;
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -136,6 +136,10 @@ public class TestPlanReportService {
|
|||
return list;
|
||||
}
|
||||
|
||||
public boolean hasRunningReport(String planId) {
|
||||
return extTestPlanReportContentMapper.hasRunningReport(planId);
|
||||
}
|
||||
|
||||
public void setTestPlanReportPassRate(List<TestPlanReportDTO> list) {
|
||||
for (TestPlanReportDTO testPlanReportDTO : list) {
|
||||
// 如果数据库查询成功率字段为空或 0 则重新计算一次
|
||||
|
|
|
@ -318,6 +318,10 @@ public class TestPlanService {
|
|||
|
||||
public int deleteTestPlan(String planId) {
|
||||
|
||||
if (testPlanReportService.hasRunningReport(planId)) {
|
||||
MSException.throwException(Translator.get("test_plan_delete_exec_error"));
|
||||
}
|
||||
|
||||
// 发送删除通知
|
||||
try {
|
||||
kafkaTemplate.send(KafkaTopicConstants.TEST_PLAN_DELETED_TOPIC, objectMapper.writeValueAsString(List.of(planId)));
|
||||
|
|
|
@ -225,4 +225,5 @@ jira_auth_error=Account name or password (Token) is wrong
|
|||
jira_auth_url_error=The test connection failed, please check whether the Jira address is correct
|
||||
|
||||
platform_plugin_not_exit=Platform docking function has been plug-in, please download the corresponding version of the plug-in:
|
||||
plan_warning=The test plan does not have an associated executable use case
|
||||
plan_warning=The test plan does not have an associated executable use case
|
||||
test_plan_delete_exec_error=The test plan is being executed
|
||||
|
|
|
@ -198,3 +198,4 @@ jira_auth_url_error=测试连接失败,请检查Jira地址是否正确
|
|||
|
||||
platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件:
|
||||
plan_warning=测试计划没有关联可执行的用例
|
||||
test_plan_delete_exec_error=测试计划正在执行中
|
||||
|
|
|
@ -198,4 +198,5 @@ jira_auth_error=賬號名或密碼(Token)錯誤
|
|||
jira_auth_url_error=測試連接失敗,請檢查Jira地址是否正確
|
||||
|
||||
platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件:
|
||||
plan_warning=測試計劃沒有關聯可執行的用例
|
||||
plan_warning=測試計劃沒有關聯可執行的用例
|
||||
test_plan_delete_exec_error=測試計劃正在執行中
|
||||
|
|
Loading…
Reference in New Issue