diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index f64a206e4d..f2b30a6f5d 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -448,8 +448,14 @@ public class PerformanceTestService { checkQuota(request, true); // copy test LoadTestWithBLOBs copy = loadTestMapper.selectByPrimaryKey(request.getId()); + String copyName = copy.getName() + " Copy"; + + if (StringUtils.length(copyName) > 30) { + MSException.throwException(Translator.get("load_test_name_length")); + } + copy.setId(UUID.randomUUID().toString()); - copy.setName(copy.getName() + " Copy"); + copy.setName(copyName); copy.setCreateTime(System.currentTimeMillis()); copy.setUpdateTime(System.currentTimeMillis()); copy.setStatus(APITestStatus.Saved.name()); diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 64bf1a87af..a72aff1d69 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -42,6 +42,7 @@ cannot_edit_load_test_running=Cannot modify the running test test_not_found=Test cannot be found: test_not_running=Test is not running load_test_already_exists=Duplicate load test name +load_test_name_length=The length of the test name exceeds the limit no_nodes_message=No node message duplicate_node_ip=Duplicate IPs duplicate_node_port=Duplicate Ports diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 8a652ce710..0038ba2c7e 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -42,6 +42,7 @@ cannot_edit_load_test_running=不能修改正在运行的测试 test_not_found=测试不存在: test_not_running=测试未运行 load_test_already_exists=测试名称不能重复 +load_test_name_length=测试名称长度超过限制 no_nodes_message=没有节点信息 duplicate_node_ip=节点 IP 重复 duplicate_node_port=节点 Port 重复 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 68f9b23571..73845f693d 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -42,6 +42,7 @@ cannot_edit_load_test_running=不能修改正在運行的測試 test_not_found=測試不存在: test_not_running=測試未運行 load_test_already_exists=測試名稱不能重復 +load_test_name_length=測試名稱長度超過限制 no_nodes_message=沒有節點信息 duplicate_node_ip=節點 IP 重復 duplicate_node_port=節點 Port 重復