From 6f7edddb0311412f9826e196dc1bcc5dc25313e3 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 23 Feb 2021 17:27:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E5=90=AF=E5=8A=A8jmeter=E4=B9=8B=E5=89=8D=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=AB=99=E7=82=B9=E9=85=8D=E7=BD=AE=E6=98=AF=E5=90=A6=E5=8F=AF?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/commons/utils/ShiroUtils.java | 1 + .../performance/controller/JmeterFileController.java | 5 +++++ .../performance/engine/docker/DockerTestEngine.java | 6 +++--- backend/src/main/java/io/metersphere/xpack | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/commons/utils/ShiroUtils.java b/backend/src/main/java/io/metersphere/commons/utils/ShiroUtils.java index 27430e98ae..78c1d168fc 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/ShiroUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/ShiroUtils.java @@ -25,6 +25,7 @@ public class ShiroUtils { filterChainDefinitionMap.put("/favicon.ico", "anon"); filterChainDefinitionMap.put("/display/file/**", "anon"); filterChainDefinitionMap.put("/jmeter/download/**", "anon"); + filterChainDefinitionMap.put("/jmeter/ping", "anon"); filterChainDefinitionMap.put("/authsource/list/allenable", "anon"); filterChainDefinitionMap.put("/sso/signin", "anon"); filterChainDefinitionMap.put("/sso/callback", "anon"); diff --git a/backend/src/main/java/io/metersphere/performance/controller/JmeterFileController.java b/backend/src/main/java/io/metersphere/performance/controller/JmeterFileController.java index f39070d3b8..6ad3c39089 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/JmeterFileController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/JmeterFileController.java @@ -18,6 +18,11 @@ public class JmeterFileController { @Resource private JmeterFileService jmeterFileService; + @GetMapping("ping") + public String checkStatus() { + return "PONG"; + } + @GetMapping("download") public ResponseEntity downloadJmeterFiles(@RequestParam("testId") String testId, @RequestParam("resourceId") String resourceId, @RequestParam("ratio") double ratio, @RequestParam("startTime") long startTime, diff --git a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java index c59a8664e1..eb28578592 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java +++ b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java @@ -74,14 +74,14 @@ public class DockerTestEngine extends AbstractEngine { BaseSystemConfigDTO baseInfo = CommonBeanFactory.getBean(SystemParameterService.class).getBaseInfo(); KafkaProperties kafkaProperties = CommonBeanFactory.getBean(KafkaProperties.class); JmeterProperties jmeterProperties = CommonBeanFactory.getBean(JmeterProperties.class); - String metersphereUrl = "http://localhost:8081"; + String metersphereUrl = "http://localhost:8081"; // 占位符 if (baseInfo != null) { metersphereUrl = baseInfo.getUrl(); } - + String jmeterPingUrl = metersphereUrl + "/jmeter/ping"; // 检查下载地址是否正确 // docker 不能从 localhost 中下载文件 if (StringUtils.contains(metersphereUrl, "http://localhost") - || !UrlTestUtils.testUrlWithTimeOut(metersphereUrl, 1000)) { + || !UrlTestUtils.testUrlWithTimeOut(jmeterPingUrl, 1000)) { MSException.throwException(Translator.get("run_load_test_file_init_error")); } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index b9042074b7..611c38a8b0 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit b9042074b780205e275c674f64417799110519fd +Subproject commit 611c38a8b0db7180ea4d4c8ace749ac25499672d