diff --git a/backend/src/main/java/io/metersphere/commons/utils/UrlTestUtils.java b/backend/src/main/java/io/metersphere/commons/utils/UrlTestUtils.java index d891194623..d536cf484d 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/UrlTestUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/UrlTestUtils.java @@ -5,7 +5,7 @@ import java.net.URLConnection; public class UrlTestUtils { - /* public static boolean testUrlWithTimeOut(String urlString, int timeOutMillSeconds) { + public static boolean testUrlWithTimeOut(String urlString, int timeOutMillSeconds) { try { URL url = new URL(urlString); URLConnection co = url.openConnection(); @@ -16,5 +16,5 @@ public class UrlTestUtils { LogUtil.error(e); return false; } - }*/ + } } 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 da06425f46..abcfa543c8 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 @@ -80,10 +80,10 @@ public class DockerTestEngine extends AbstractEngine { } // docker 不能从 localhost 中下载文件 - /* if (StringUtils.contains(metersphereUrl, "http://localhost") + if (StringUtils.contains(metersphereUrl, "http://localhost") || !UrlTestUtils.testUrlWithTimeOut(metersphereUrl, 1000)) { MSException.throwException(Translator.get("run_load_test_file_init_error")); - }*/ + } Map env = new HashMap<>(); env.put("RATIO", "" + ratio);