fix(jenkins): 修复jenkins执行接口用例选择环境的问题

This commit is contained in:
CaptainB 2021-11-26 10:33:52 +08:00 committed by 刘瑞斌
parent 8b8392ddcf
commit f232f4e177
2 changed files with 4 additions and 3 deletions

View File

@ -810,6 +810,9 @@ public class ApiTestCaseService {
if (caseWithBLOBs == null) {
return null;
}
if (StringUtils.isBlank(request.getEnvironmentId())) {
request.setEnvironmentId(extApiTestCaseMapper.getApiCaseEnvironment(request.getCaseId()));
}
//提前生成报告
ApiDefinitionExecResult report = addResult(caseWithBLOBs.getId(), APITestStatus.Running.name(), request.getReportId());
report.setName(caseWithBLOBs.getName());
@ -1202,9 +1205,7 @@ public class ApiTestCaseService {
if (StringUtils.isBlank(environmentId)) {
return null;
}
// "environmentId"
try {
environmentId = environmentId.substring(1, environmentId.length() - 1);
return apiTestEnvironmentMapper.selectByPrimaryKey(environmentId);
} catch (Exception e) {
LogUtil.error("api case environmentId incorrect parsing. api case id: " + caseId);

View File

@ -726,7 +726,7 @@
order by `order` desc limit 1;
</select>
<select id="getApiCaseEnvironment" resultType="java.lang.String">
select request -> '$.useEnvironment' from api_test_case where id = #{caseId}
select request ->> '$.useEnvironment' from api_test_case where id = #{caseId}
</select>
<update id="deleteToGc" parameterType="io.metersphere.api.dto.definition.ApiTestCaseRequest">
update api_test_case