fix(性能测试): 启动jmeter之前检查站点配置是否可用
This commit is contained in:
parent
236781a575
commit
6f7edddb03
|
@ -25,6 +25,7 @@ public class ShiroUtils {
|
|||
filterChainDefinitionMap.put("/favicon.ico", "anon");
|
||||
filterChainDefinitionMap.put("/display/file/**", "anon");
|
||||
filterChainDefinitionMap.put("/jmeter/download/**", "anon");
|
||||
filterChainDefinitionMap.put("/jmeter/ping", "anon");
|
||||
filterChainDefinitionMap.put("/authsource/list/allenable", "anon");
|
||||
filterChainDefinitionMap.put("/sso/signin", "anon");
|
||||
filterChainDefinitionMap.put("/sso/callback", "anon");
|
||||
|
|
|
@ -18,6 +18,11 @@ public class JmeterFileController {
|
|||
@Resource
|
||||
private JmeterFileService jmeterFileService;
|
||||
|
||||
@GetMapping("ping")
|
||||
public String checkStatus() {
|
||||
return "PONG";
|
||||
}
|
||||
|
||||
@GetMapping("download")
|
||||
public ResponseEntity<byte[]> downloadJmeterFiles(@RequestParam("testId") String testId, @RequestParam("resourceId") String resourceId,
|
||||
@RequestParam("ratio") double ratio, @RequestParam("startTime") long startTime,
|
||||
|
|
|
@ -74,14 +74,14 @@ public class DockerTestEngine extends AbstractEngine {
|
|||
BaseSystemConfigDTO baseInfo = CommonBeanFactory.getBean(SystemParameterService.class).getBaseInfo();
|
||||
KafkaProperties kafkaProperties = CommonBeanFactory.getBean(KafkaProperties.class);
|
||||
JmeterProperties jmeterProperties = CommonBeanFactory.getBean(JmeterProperties.class);
|
||||
String metersphereUrl = "http://localhost:8081";
|
||||
String metersphereUrl = "http://localhost:8081"; // 占位符
|
||||
if (baseInfo != null) {
|
||||
metersphereUrl = baseInfo.getUrl();
|
||||
}
|
||||
|
||||
String jmeterPingUrl = metersphereUrl + "/jmeter/ping"; // 检查下载地址是否正确
|
||||
// docker 不能从 localhost 中下载文件
|
||||
if (StringUtils.contains(metersphereUrl, "http://localhost")
|
||||
|| !UrlTestUtils.testUrlWithTimeOut(metersphereUrl, 1000)) {
|
||||
|| !UrlTestUtils.testUrlWithTimeOut(jmeterPingUrl, 1000)) {
|
||||
MSException.throwException(Translator.get("run_load_test_file_init_error"));
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b9042074b780205e275c674f64417799110519fd
|
||||
Subproject commit 611c38a8b0db7180ea4d4c8ace749ac25499672d
|
Loading…
Reference in New Issue