From bafee17bc052a0ea36e04fc32eea0a9de623454b Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 15 Oct 2024 18:55:42 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=8E=BB=E9=99=A4=20TTY=20?= =?UTF-8?q?=E6=8F=90=E9=AB=98=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/api/engine/KubernetesExecEngine.java | 12 ++++++------ .../metersphere/api/engine/KubernetesProvider.java | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesExecEngine.java b/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesExecEngine.java index 5859b6a9a5..b403fe8c0d 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesExecEngine.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesExecEngine.java @@ -26,8 +26,8 @@ public class KubernetesExecEngine implements ApiEngine { /** * 单调执行构造函数 * - * @param request - * @param resource + * @param request 任务请求参数 + * @param resource 资源池 */ public KubernetesExecEngine(TaskRequestDTO request, TestResourceDTO resource) { this.request = request; @@ -37,8 +37,8 @@ public class KubernetesExecEngine implements ApiEngine { /** * 批量执行构造函数 * - * @param batchRequestDTO - * @param resource + * @param batchRequestDTO 批量任务请求参数 + * @param resource 资源池 */ public KubernetesExecEngine(TaskBatchRequestDTO batchRequestDTO, TestResourceDTO resource) { this.resource = resource; @@ -48,8 +48,8 @@ public class KubernetesExecEngine implements ApiEngine { /** * 停止执行构造函数 * - * @param reportIds - * @param resource + * @param reportIds 任务ID列表 + * @param resource 资源池 */ public KubernetesExecEngine(List reportIds, TestResourceDTO resource) { this.resource = resource; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesProvider.java b/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesProvider.java index 2fc324adbd..a57110a123 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesProvider.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/engine/KubernetesProvider.java @@ -68,8 +68,8 @@ public class KubernetesProvider { /** * 执行命令 * - * @param resource - * @param command + * @param resource 资源 + * @param command 命令 */ protected static void exec(TestResourceDTO resource, Object runRequest, String command) { KubernetesClient client = getKubernetesClient(resource); @@ -150,7 +150,6 @@ public class KubernetesProvider { .redirectingInput() .writingOutput(System.out) .writingError(System.err) - .withTTY() .usingListener(new SimpleListener(runRequest, client)) .exec(SHELL_COMMAND, "-c", command); } catch (Exception e) { @@ -167,7 +166,7 @@ public class KubernetesProvider { @Override public void onFailure(Throwable t, Response response) { LogUtils.error("K8s 监听失败", t); - if (runRequest != null && !(t instanceof SocketException)) { + if (runRequest != null) { handleGeneralError(runRequest, t); } }