fix(测试跟踪): 修复更改运行方式引发的执行测试计划执行问题
--bug=1026384 --user=宋天阳 【测试跟踪】项目设置资源池禁用-测试计划选择node或k8s资源池执行-测试报告显示仍为local资源池执行 https://www.tapd.cn/55049933/s/1374000;--bug=1026386 --user=宋天阳 【测试跟踪】项目设置资源池禁用-选择资源池保存并执行-再次点开运行资源池配置显示为空 https://www.tapd.cn/55049933/s/1373999
This commit is contained in:
parent
e2c5207bce
commit
67f34ff496
|
@ -159,7 +159,9 @@ public class TestPlanService {
|
|||
@Resource
|
||||
@Lazy
|
||||
private TestPlanService testPlanService;
|
||||
|
||||
@Resource
|
||||
private BaseTestResourcePoolService baseTestResourcePoolService;
|
||||
|
||||
public TestPlan addTestPlan(AddTestPlanRequest testPlan) {
|
||||
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
||||
MSException.throwException(Translator.get("plan_name_already_exists"));
|
||||
|
@ -936,8 +938,16 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
public void verifyPool(String projectId, RunModeConfigDTO runConfig) {
|
||||
// 检查是否禁用了本地执行
|
||||
apiPoolDebugService.verifyPool(projectId, runConfig);
|
||||
if (StringUtils.isNotBlank(runConfig.getResourcePoolId())) {
|
||||
//检查保存的资源池的合法性
|
||||
TestResourcePool testResourcePool = baseTestResourcePoolService.getResourcePool(runConfig.getResourcePoolId());
|
||||
if (!StringUtils.equalsIgnoreCase(testResourcePool.getStatus(), "VALID")) {
|
||||
MSException.throwException("保存的资源池无法使用,请重新选择资源池");
|
||||
}
|
||||
} else {
|
||||
// 检查是否禁用了本地执行
|
||||
apiPoolDebugService.verifyPool(projectId, runConfig);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1859,11 +1869,6 @@ public class TestPlanService {
|
|||
RunModeConfigDTO runModeConfig = getRunModeConfigDTO(testplanRunRequest, envType, envMap, environmentGroupId, testPlanId);
|
||||
runModeConfig.setTestPlanDefaultEnvMap(testplanRunRequest.getTestPlanDefaultEnvMap());
|
||||
|
||||
if (!testplanRunRequest.isRunWithinResourcePool()) {
|
||||
//未勾选资源池运行时,将资源池ID赋空
|
||||
runModeConfig.setResourcePoolId(null);
|
||||
}
|
||||
|
||||
//执行测试计划行为,要更新TestPlan状态为进行中,并重置实际结束时间
|
||||
this.updateTestPlanExecuteInfo(testPlanId, TestPlanStatus.Underway.name());
|
||||
|
||||
|
|
|
@ -187,26 +187,18 @@
|
|||
|
||||
<script>
|
||||
import MsDialogFooter from "metersphere-frontend/src/components/MsDialogFooter";
|
||||
import { strMapToObj } from "metersphere-frontend/src/utils";
|
||||
import {strMapToObj} from "metersphere-frontend/src/utils";
|
||||
import MsTag from "metersphere-frontend/src/components/MsTag";
|
||||
import { ENV_TYPE } from "metersphere-frontend/src/utils/constants";
|
||||
import {
|
||||
getCurrentProjectID,
|
||||
getOwnerProjects,
|
||||
} from "@/business/utils/sdk-utils";
|
||||
import { getQuotaValidResourcePools } from "@/api/remote/resource-pool";
|
||||
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
|
||||
import {getCurrentProjectID, getOwnerProjects,} from "@/business/utils/sdk-utils";
|
||||
import {getQuotaValidResourcePools} from "@/api/remote/resource-pool";
|
||||
import EnvGroupPopover from "@/business/plan/env/EnvGroupPopover";
|
||||
import { getApiCaseEnv } from "@/api/remote/plan/test-plan-api-case";
|
||||
import {
|
||||
getApiScenarioEnv,
|
||||
getPlanCaseEnv,
|
||||
getPlanCaseProjectIds,
|
||||
} from "@/api/remote/plan/test-plan";
|
||||
import {getApiCaseEnv} from "@/api/remote/plan/test-plan-api-case";
|
||||
import {getApiScenarioEnv, getPlanCaseEnv, getPlanCaseProjectIds,} from "@/api/remote/plan/test-plan";
|
||||
import EnvGroupWithOption from "../env/EnvGroupWithOption";
|
||||
import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList";
|
||||
import EnvSelectPopover from "@/business/plan/env/EnvSelectPopover";
|
||||
import { getSystemBaseSetting } from "metersphere-frontend/src/api/system";
|
||||
import { getProjectConfig } from "@/api/project";
|
||||
import {getProjectConfig} from "@/api/project";
|
||||
|
||||
export default {
|
||||
name: "MsTestPlanRunModeWithEnv",
|
||||
|
@ -310,18 +302,19 @@ export default {
|
|||
this.showPopover();
|
||||
},
|
||||
getProjectApplication() {
|
||||
this.runConfig.resourcePoolId = null;
|
||||
getProjectConfig(getCurrentProjectID(), "").then((res) => {
|
||||
if (res.data && res.data.poolEnable && res.data.resourcePoolId) {
|
||||
this.runConfig.resourcePoolId = res.data.resourcePoolId;
|
||||
}
|
||||
let hasPool = false;
|
||||
this.resourcePools.forEach((item) => {
|
||||
if (item.id === this.runConfig.resourcePoolId) {
|
||||
hasPool = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (!hasPool) {
|
||||
if (res.data && res.data.poolEnable && res.data.resourcePoolId) {
|
||||
this.runConfig.resourcePoolId = res.data.resourcePoolId;
|
||||
hasPool = true;
|
||||
}
|
||||
}
|
||||
if (!hasPool) {
|
||||
this.runConfig.resourcePoolId = null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue