fix(接口测试): 修复jenkins执行测试计划会发送多个通知的问题
--bug=1013358 --user=宋天阳 【消息通知】用jenkins 跑一个包含100+ 场景的测试计划,邮箱收到100+条通知,建议只接收执行该测试计划的一个通知 https://www.tapd.cn/55049933/s/1174780
This commit is contained in:
parent
f0da2d5e83
commit
d992ac4478
|
@ -33,6 +33,7 @@ import io.metersphere.track.dto.PlanReportCaseDTO;
|
|||
import io.metersphere.utils.LoggerUtil;
|
||||
import org.apache.commons.beanutils.BeanMap;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -162,6 +163,7 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
|
||||
public List<APIScenarioReportResult> list(QueryAPIReportRequest request) {
|
||||
request = this.initRequest(request);
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
List<APIScenarioReportResult> list = extApiScenarioReportMapper.list(request);
|
||||
List<String> userIds = list.stream().map(APIScenarioReportResult::getUserId)
|
||||
|
@ -175,7 +177,20 @@ public class ApiScenarioReportService {
|
|||
return list;
|
||||
}
|
||||
|
||||
public QueryAPIReportRequest initRequest(QueryAPIReportRequest request){
|
||||
if(request != null){
|
||||
//初始化triggerMode的查询条件: 如果查询API的话,增加 JENKINS_RUN_TEST_PLAN(jenkins调用测试计划时执行的场景) 查询条件
|
||||
if(MapUtils.isNotEmpty(request.getFilters()) && request.getFilters().containsKey("trigger_mode")
|
||||
&& CollectionUtils.isNotEmpty(request.getFilters().get("trigger_mode"))
|
||||
&& request.getFilters().get("trigger_mode").contains("API") && !request.getFilters().get("trigger_mode").contains(ReportTriggerMode.JENKINS_RUN_TEST_PLAN.name())){
|
||||
request.getFilters().get("trigger_mode").add(ReportTriggerMode.JENKINS_RUN_TEST_PLAN.name());
|
||||
}
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
public List<String> idList(QueryAPIReportRequest request) {
|
||||
request = this.initRequest(request);
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
return extApiScenarioReportMapper.idList(request);
|
||||
}
|
||||
|
@ -224,10 +239,6 @@ public class ApiScenarioReportService {
|
|||
if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())) {
|
||||
return report;
|
||||
}
|
||||
if(StringUtils.equalsAnyIgnoreCase(report.getTriggerMode(),ReportTriggerMode.JENKINS_RUN_TEST_PLAN.name())){
|
||||
//jenkins运行测试计划时执行的场景,触发方式改回API
|
||||
report.setTriggerMode(ReportTriggerMode.API.name());
|
||||
}
|
||||
if (runMode.equals("CASE")) {
|
||||
report.setTriggerMode(TriggerMode.MANUAL.name());
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<span v-if="triggerMode === 'TEST_PLAN_SCHEDULE'">{{$t('commons.trigger_mode.test_plan_schedule')}}</span>
|
||||
<span v-if="triggerMode === 'TEST_PLAN_API'">{{$t('commons.trigger_mode.test_plan_api')}}</span>
|
||||
<span v-if="triggerMode === 'API'">{{$t('commons.trigger_mode.api')}}</span>
|
||||
<span v-if="triggerMode === 'JENKINS_RUN_TEST_PLAN'">{{$t('commons.trigger_mode.api')}}</span>
|
||||
<span v-if="triggerMode === 'BATCH'">{{$t('api_test.automation.batch_execute')}}</span>
|
||||
</span>
|
||||
|
||||
|
|
Loading…
Reference in New Issue