From a88a5e305b61a86dee8805922cc63ef6bfde7f9e Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 8 Oct 2024 15:51:01 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=85=AC=E5=85=B1=20DTO=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=B5=84=E6=BA=90=E6=B1=A0=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/metersphere/api/engine/KubernetesExecEngine.java | 2 +- .../java/io/metersphere/api/engine/KubernetesProvider.java | 2 +- .../java/io/metersphere/api/service/ApiExecuteService.java | 4 +++- .../system/dto/pool/TestResourcePoolReturnDTO.java | 3 +++ 4 files changed, 8 insertions(+), 3 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 ff19f3a5d1..53811f340c 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 @@ -33,7 +33,7 @@ public class KubernetesExecEngine implements ApiEngine { @Override public void execute(String command) { // 初始化任务 - LogUtils.info("K8s 开始执行: {}", command); + LogUtils.info("CURL 命令:【 " + command + " 】"); this.runApi(command); } 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 f39327a937..da377b2b91 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 @@ -51,7 +51,7 @@ public class KubernetesProvider { public static void exec(TestResourceDTO resource, Object runRequest, String command) { try (KubernetesClient client = getKubernetesClient(resource)) { Pod pod = getExecPod(client, resource); - LogUtils.info("CURL 命令:【 " + command + " 】"); + LogUtils.info("当前执行 Pod:【 " + pod.getMetadata().getName() + " 】"); client.pods().inNamespace(client.getNamespace()).withName(pod.getMetadata().getName()) .redirectingInput() .writingOutput(System.out) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiExecuteService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiExecuteService.java index 71d993a7dc..5ba0338121 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiExecuteService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiExecuteService.java @@ -593,7 +593,9 @@ public class ApiExecuteService { !commonProjectService.validateProjectResourcePool(testResourcePool, projectId)) { throw new MSException(ApiResultCode.EXECUTE_RESOURCE_POOL_NOT_CONFIG); } - return testResourcePoolService.getTestResourcePoolDetail(resourcePoolId); + TestResourcePoolReturnDTO poolReturnDTO = testResourcePoolService.getTestResourcePoolDetail(resourcePoolId); + poolReturnDTO.setType(testResourcePool.getType()); + return poolReturnDTO; } public String getProjectApiResourcePoolId(String projectId) { diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/pool/TestResourcePoolReturnDTO.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/pool/TestResourcePoolReturnDTO.java index 0b749a2d71..afea8f90c9 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/pool/TestResourcePoolReturnDTO.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/pool/TestResourcePoolReturnDTO.java @@ -10,6 +10,9 @@ import lombok.EqualsAndHashCode; public class TestResourcePoolReturnDTO extends TestResourcePool { private TestResourceReturnDTO testResourceReturnDTO; + @Schema(description = "资源池类型, Node/Kubernetes") + private String type; + @Schema(description = "资源池是否在使用中") private Boolean inUsed; }