fix(性能测试): 修复没关联jmx不能删除性能测试的问题

--bug=1024336 --user=刘瑞斌 [BUG]性能测试关联的文件被删除后,删除性能测试失败 #22616 https://www.tapd.cn/55049933/s/1349043

Closes #22616
This commit is contained in:
CaptainB 2023-03-13 18:16:05 +08:00 committed by 刘瑞斌
parent dcc0370685
commit 82301b2786
1 changed files with 0 additions and 13 deletions

View File

@ -108,19 +108,6 @@ public class PerformanceTestService {
List<LoadTest> loadTests = loadTestMapper.selectByExample(example);
loadTests.forEach(test -> {
// 删除时保存jmx内容
List<FileMetadata> fileMetadataList = getFileMetadataByTestId(test.getId());
List<FileMetadata> jmxFiles = fileMetadataList.stream().filter(f -> StringUtils.equalsIgnoreCase(f.getType(), FileType.JMX.name())).collect(Collectors.toList());
byte[] bytes = EngineFactory.mergeJmx(jmxFiles);
LoadTestReportExample loadTestReportExample = new LoadTestReportExample();
loadTestReportExample.createCriteria().andTestIdEqualTo(test.getId());
List<LoadTestReport> loadTestReports = loadTestReportMapper.selectByExample(loadTestReportExample);
loadTestReports.forEach(loadTestReport -> {
LoadTestReportWithBLOBs record = new LoadTestReportWithBLOBs();
record.setId(loadTestReport.getId());
record.setJmxContent(new String(bytes, StandardCharsets.UTF_8));
extLoadTestReportMapper.updateJmxContentIfAbsent(record);
});
baseScheduleService.deleteByResourceId(test.getId(), ScheduleGroup.PERFORMANCE_TEST.name());
// delete load_test