容器log
This commit is contained in:
parent
1578a81d8f
commit
3e655fbc55
|
@ -21,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "performance")
|
||||
|
@ -88,6 +89,11 @@ public class PerformanceTestController {
|
|||
performanceTestService.run(request);
|
||||
}
|
||||
|
||||
@GetMapping("/log/{testId}")
|
||||
public Map<String, String> stop(@PathVariable String testId) {
|
||||
return performanceTestService.log(testId);
|
||||
}
|
||||
|
||||
@GetMapping("/file/metadata/{testId}")
|
||||
public List<FileMetadata> getFileMetadata(@PathVariable String testId) {
|
||||
return fileService.getFileMetadataByTestId(testId);
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -229,6 +230,23 @@ public class PerformanceTestService {
|
|||
}
|
||||
}
|
||||
|
||||
public Map<String, String> log(String testId) {
|
||||
final LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(testId);
|
||||
if (loadTest == null) {
|
||||
MSException.throwException(Translator.get("test_not_found") + testId);
|
||||
}
|
||||
|
||||
if (!StringUtils.equals(loadTest.getStatus(), PerformanceTestStatus.Running.name())) {
|
||||
MSException.throwException(Translator.get("test_not_running"));
|
||||
}
|
||||
|
||||
Engine engine = EngineFactory.createEngine(loadTest);
|
||||
if (engine == null) {
|
||||
MSException.throwException(String.format("Engine is null,test ID:%s", testId));
|
||||
}
|
||||
return engine.log();
|
||||
}
|
||||
|
||||
public List<LoadTestDTO> recentTestPlans(QueryTestPlanRequest request) {
|
||||
// 查询最近的测试计划
|
||||
request.setRecent(true);
|
||||
|
@ -260,4 +278,5 @@ public class PerformanceTestService {
|
|||
example.createCriteria().andTestResourcePoolIdEqualTo(resourcePoolId);
|
||||
return loadTestMapper.selectByExampleWithBLOBs(example);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,4 +19,6 @@ duplicate_node_ip=Duplicate IPs
|
|||
only_one_k8s=Only one K8s can be added
|
||||
organization_id_is_null=Organization ID cannot be null
|
||||
max_thread_insufficient=The number of concurrent users exceeds
|
||||
cannot_edit_load_test_running=Cannot modify the running test
|
||||
cannot_edit_load_test_running=Cannot modify the running test
|
||||
test_not_found=Test cannot be found:
|
||||
test_not_running=Test is not running
|
|
@ -19,4 +19,6 @@ duplicate_node_ip=节点 IP 重复
|
|||
only_one_k8s=只能添加一个 K8s
|
||||
organization_id_is_null=组织 ID 不能为空
|
||||
max_thread_insufficient=并发用户数超额
|
||||
cannot_edit_load_test_running=不能修改正在运行的测试
|
||||
cannot_edit_load_test_running=不能修改正在运行的测试
|
||||
test_not_found=测试不存在:
|
||||
test_not_running=测试未运行
|
Loading…
Reference in New Issue