fix(性能测试): 复制测试时加上随机字符,避免名称重复

--bug=1020087 --user=刘瑞斌 【性能测试】用例有两个版本,分别复制该用例的两个版本,复制的用例名可以重名 https://www.tapd.cn/55049933/s/1303166
This commit is contained in:
CaptainB 2022-11-23 18:04:10 +08:00 committed by 刘瑞斌
parent 5af43ac612
commit 1fe2f1c430
1 changed files with 2 additions and 1 deletions

View File

@ -30,6 +30,7 @@ import io.metersphere.xpack.quota.service.QuotaService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
@ -594,7 +595,7 @@ public class PerformanceTestService {
request.setProjectId(copy.getProjectId());
checkQuota(request, true);
// copy test
String copyName = copy.getName() + " Copy";
String copyName = copy.getName() + "_" + RandomStringUtils.randomAlphanumeric(5);
if (StringUtils.length(copyName) > 30) {
MSException.throwException(Translator.get("load_test_name_length"));