Browse Source

标准化测试扩充

LingxinMeng 2 years ago
parent
commit
4c43e754af

+ 2 - 1
api-common/src/main/java/api/common/util/OsUtil.java

@@ -4,6 +4,7 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 
 import java.io.BufferedInputStream;
+import java.io.File;
 import java.io.InputStream;
 import java.net.InetAddress;
 
@@ -27,7 +28,7 @@ public class OsUtil {
         in.close();
         process.destroy();
         result = out.toString();
-        log.info("执行结果为:{}", result);
+        log.info("执行结果为:{}", result.replace(File.separator, ""));
     }
 
     @SneakyThrows

+ 2 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/application/service/ProjectService.java

@@ -22,6 +22,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import io.minio.MinioClient;
 import lombok.SneakyThrows;
+import lombok.Synchronized;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.kafka.clients.admin.Admin;
 import org.apache.kafka.clients.producer.RecordMetadata;
@@ -568,6 +569,7 @@ public class ProjectService {
     }
 
 
+    @Synchronized
     public void expand(String projectId, String isChoiceGpu, int totalParallelism, int expandParallelism, boolean isDone) {
         log.info("扩充项目 {} {} 个并行度", projectId, expandParallelism);
         //1 获取剩余并行度和即将使用的各node的并行度

+ 6 - 6
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/domain/service/ProjectDomainService.java

@@ -838,19 +838,19 @@ public class ProjectDomainService {
     @SneakyThrows
     public void selectProjectDetailsById(String projectType, String projectId) {
         String tokenUrl = customConfiguration.getTokenUri() + "?grant_type=client_credentials" + "&client_id=" + customConfiguration.getClientId() + "&client_secret=" + customConfiguration.getClientSecret();
-        log.info("获取仿真云平台 token:" + tokenUrl);
+        log.debug("获取仿真云平台 token:" + tokenUrl);
         String response = HttpUtil.get(tokenUrl);
         ObjectMapper objectMapper = new ObjectMapper();
         JsonNode jsonNode = objectMapper.readTree(response);
         String accessToken = jsonNode.path("access_token").asText();
-        log.info("仿真云平台 token 为:" + accessToken);
+        log.debug("仿真云平台 token 为:" + accessToken);
         Map<String, String> headers = new HashMap<>();
         headers.put("Authorization", "Bearer " + accessToken);
         Map<String, String> params = new HashMap<>();
         params.put("projectType", projectType);
         params.put("id", projectId);
         String result = HttpUtil.post(customConfiguration.getProjectDetailsUri(), headers, params);
-        log.info("访问仿真云平台项目详情接口:" + customConfiguration.getProjectDetailsUri() + ",请求头为:" + headers + ",请求体为:" + params + "结果为:" + result);
+        log.debug("访问仿真云平台项目详情接口:" + customConfiguration.getProjectDetailsUri() + ",请求头为:" + headers + ",请求体为:" + params + "结果为:" + result);
         ResponseBodyVO<?> responseBodyVO = JsonUtil.jsonToBean(result, ResponseBodyVO.class);
         String projectDetailsVOJson = JsonUtil.beanToJson(responseBodyVO.getInfo());
         TimeUnit.SECONDS.sleep(5);
@@ -867,19 +867,19 @@ public class ProjectDomainService {
     @SneakyThrows
     public void selectProjectReportById(String projectType, String projectId) {
         String tokenUrl = customConfiguration.getTokenUri() + "?grant_type=client_credentials" + "&client_id=" + customConfiguration.getClientId() + "&client_secret=" + customConfiguration.getClientSecret();
-        log.info("获取仿真云平台 token:" + tokenUrl);
+        log.debug("获取仿真云平台 token:" + tokenUrl);
         String response = HttpUtil.get(tokenUrl);
         ObjectMapper objectMapper = new ObjectMapper();
         JsonNode jsonNode = objectMapper.readTree(response);
         String accessToken = jsonNode.path("access_token").asText();
-        log.info("仿真云平台 token 为:" + accessToken);
+        log.debug("仿真云平台 token 为:" + accessToken);
         Map<String, String> headers = new HashMap<>();
         headers.put("Authorization", "Bearer " + accessToken);
         Map<String, String> params = new HashMap<>();
         params.put("projectType", projectType);
         params.put("id", projectId);
         String result = HttpUtil.post(customConfiguration.getProjectReportUri(), headers, params);
-        log.info("访问仿真云平台项目报告接口:" + customConfiguration.getProjectReportUri() + ",请求头为:" + headers + ",请求体为:" + params + "结果为:" + result);
+        log.debug("访问仿真云平台项目报告接口:" + customConfiguration.getProjectReportUri() + ",请求头为:" + headers + ",请求体为:" + params + "结果为:" + result);
         ResponseBodyVO<?> responseBodyVO = JsonUtil.jsonToBean(result, ResponseBodyVO.class);
         String projectReportVOJson = JsonUtil.beanToJson(responseBodyVO.getInfo());
         TimeUnit.SECONDS.sleep(5);

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/infrastructure/persistence/kubernetes/KubernetesUtil.java

@@ -242,7 +242,7 @@ public class KubernetesUtil {
 
     /**
      * 删除 pod
-     * 步删除会等待 pod 完全删除完毕,即资源释放完全
+     * 步删除会等待 pod 完全删除完毕,即资源释放完全
      *
      * @param apiClient     api 客户端
      * @param namespaceName namespace 名称