fix(接口测试): 修复用例新增前后置步骤数据源切换错误问题

--bug=1012764 --user=赵勇 【接口测试】接口前后置sql添加后,再添加其他前后置操作,数据源会消失 https://www.tapd.cn/55049933/s/1148430
This commit is contained in:
fit2-zhao 2022-04-26 18:03:47 +08:00 committed by fit2-zhao
parent 4ddc9eeb89
commit 35b4b87f9e
5 changed files with 11 additions and 8 deletions

View File

@ -451,7 +451,6 @@ public class ApiDefinitionExecResultService {
}
saveResult.setType(type);
saveResult.setStatus(status);
saveResult.setResourceId(item.getName());
saveResult.setStartTime(item.getStartTime());
saveResult.setEndTime(item.getEndTime());

View File

@ -350,7 +350,8 @@ public class ApiExecutionQueueService {
if (report == null) {
executionQueueDetailMapper.deleteByPrimaryKey(item.getId());
}
if (report != null && StringUtils.equalsAnyIgnoreCase(report.getStatus(), TestPlanReportStatus.RUNNING.name(), APITestStatus.Waiting.name())
// 这里只处理已经开始执行的队列如果 报告状态是 Waiting 表示还没开始暂不处理
if (report != null && StringUtils.equalsAnyIgnoreCase(report.getStatus(), TestPlanReportStatus.RUNNING.name())
&& report.getUpdateTime() < timeout) {
report.setStatus(ScenarioStatus.Timeout.name());
apiScenarioReportMapper.updateByPrimaryKeySelective(report);

View File

@ -1632,10 +1632,10 @@ export default {
this.sort();
this.$nextTick(() => {
this.cancelBatchProcessing();
});
if (isRefresh) {
this.reloadTree = getUUID();
}
});
//
let v1 = {
apiScenarioModuleId: this.currentScenario.apiScenarioModuleId,

View File

@ -291,7 +291,7 @@ export default {
this.$emit('refreshModule');
},
setNewSource(environment, obj) {
if (environment.config && environment.config.databaseConfigs) {
if (environment.config && environment.config.databaseConfigs && environment.config.databaseConfigs.length > 0) {
let dataSources = environment.config.databaseConfigs.filter(item => item.name === obj.targetDataSourceName);
if (dataSources && dataSources.length > 0) {
obj.dataSourceId = dataSources[0].id;

View File

@ -259,11 +259,14 @@ export default {
setOwnEnvironment(scenarioDefinition) {
for (let i in scenarioDefinition) {
let typeArray = ["JDBCPostProcessor", "JDBCSampler", "JDBCPreProcessor"]
if (typeArray.indexOf(scenarioDefinition[i].type) !== -1) {
if (typeArray.indexOf(scenarioDefinition[i].type) !== -1
&& this.request.environmentId && !scenarioDefinition[i].environmentId) {
scenarioDefinition[i].environmentId = this.request.environmentId;
if (this.request.dataSourceId && !scenarioDefinition[i].dataSourceId) {
scenarioDefinition[i].dataSourceId = this.request.dataSourceId;
}
}
}
},
filterNode(value, data) {
if (data.type && value.indexOf(data.type) !== -1) {