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.setType(type);
saveResult.setStatus(status); saveResult.setStatus(status);
saveResult.setResourceId(item.getName());
saveResult.setStartTime(item.getStartTime()); saveResult.setStartTime(item.getStartTime());
saveResult.setEndTime(item.getEndTime()); saveResult.setEndTime(item.getEndTime());

View File

@ -350,7 +350,8 @@ public class ApiExecutionQueueService {
if (report == null) { if (report == null) {
executionQueueDetailMapper.deleteByPrimaryKey(item.getId()); 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.getUpdateTime() < timeout) {
report.setStatus(ScenarioStatus.Timeout.name()); report.setStatus(ScenarioStatus.Timeout.name());
apiScenarioReportMapper.updateByPrimaryKeySelective(report); apiScenarioReportMapper.updateByPrimaryKeySelective(report);

View File

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

View File

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

View File

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