Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
d7df95c7
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 3 年多
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d7df95c7
编写于
7月 27, 2020
作者:
C
chenjianxing
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'v1.1' of
https://github.com/metersphere/server
into v1.1
上级
274f820d
01b6f1b7
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
117 addition
and
48 deletion
+117
-48
backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java
...ere/performance/controller/PerformanceTestController.java
+3
-3
backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java
...tersphere/performance/service/PerformanceTestService.java
+14
-2
backend/src/main/java/io/metersphere/performance/service/ReportService.java
...ava/io/metersphere/performance/service/ReportService.java
+8
-1
backend/src/main/java/io/metersphere/websocket/ReportWebSocket.java
...c/main/java/io/metersphere/websocket/ReportWebSocket.java
+3
-0
backend/src/main/resources/logback.xml
backend/src/main/resources/logback.xml
+8
-5
frontend/src/business/components/performance/report/PerformanceReportView.vue
...s/components/performance/report/PerformanceReportView.vue
+36
-21
frontend/src/business/components/performance/report/components/ErrorLog.vue
...ess/components/performance/report/components/ErrorLog.vue
+3
-0
frontend/src/business/components/performance/report/components/LogDetails.vue
...s/components/performance/report/components/LogDetails.vue
+3
-0
frontend/src/business/components/performance/report/components/RequestStatistics.vue
...nents/performance/report/components/RequestStatistics.vue
+3
-0
frontend/src/business/components/performance/report/components/TestOverview.vue
...components/performance/report/components/TestOverview.vue
+3
-0
frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue
...s/components/performance/test/EditPerformanceTestPlan.vue
+16
-10
frontend/src/i18n/en-US.js
frontend/src/i18n/en-US.js
+6
-2
frontend/src/i18n/zh-CN.js
frontend/src/i18n/zh-CN.js
+5
-2
frontend/src/i18n/zh-TW.js
frontend/src/i18n/zh-TW.js
+6
-2
未找到文件。
backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java
浏览文件 @
d7df95c7
...
...
@@ -102,9 +102,9 @@ public class PerformanceTestController {
return
performanceTestService
.
run
(
request
);
}
@GetMapping
(
"stop/{reportId}"
)
public
void
stopTest
(
@PathVariable
String
reportId
)
{
performanceTestService
.
stopTest
(
reportId
);
@GetMapping
(
"stop/{reportId}
/{forceStop}
"
)
public
void
stopTest
(
@PathVariable
String
reportId
,
@PathVariable
boolean
forceStop
)
{
performanceTestService
.
stopTest
(
reportId
,
forceStop
);
}
@GetMapping
(
"/file/metadata/{testId}"
)
...
...
backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java
浏览文件 @
d7df95c7
...
...
@@ -401,7 +401,19 @@ public class PerformanceTestService {
scheduleService
.
addOrUpdateCronJob
(
request
,
PerformanceTestJob
.
getJobKey
(
request
.
getResourceId
()),
PerformanceTestJob
.
getTriggerKey
(
request
.
getResourceId
()),
PerformanceTestJob
.
class
);
}
public
void
stopTest
(
String
reportId
)
{
reportService
.
deleteReport
(
reportId
);
public
void
stopTest
(
String
reportId
,
boolean
forceStop
)
{
if
(
forceStop
)
{
reportService
.
deleteReport
(
reportId
);
}
else
{
LoadTestReport
loadTestReport
=
loadTestReportMapper
.
selectByPrimaryKey
(
reportId
);
LoadTestWithBLOBs
loadTest
=
loadTestMapper
.
selectByPrimaryKey
(
loadTestReport
.
getTestId
());
final
Engine
engine
=
EngineFactory
.
createEngine
(
loadTest
);
if
(
engine
==
null
)
{
MSException
.
throwException
(
String
.
format
(
"Stop report fail. create engine fail,report ID:%s"
,
reportId
));
}
reportService
.
stopEngine
(
loadTest
,
engine
);
// 停止测试之后设置报告的状态
reportService
.
updateStatus
(
reportId
,
PerformanceTestStatus
.
Completed
.
name
());
}
}
}
backend/src/main/java/io/metersphere/performance/service/ReportService.java
浏览文件 @
d7df95c7
...
...
@@ -99,7 +99,7 @@ public class ReportService {
loadTestReportMapper
.
deleteByPrimaryKey
(
reportId
);
}
p
rivate
void
stopEngine
(
LoadTestWithBLOBs
loadTest
,
Engine
engine
)
{
p
ublic
void
stopEngine
(
LoadTestWithBLOBs
loadTest
,
Engine
engine
)
{
engine
.
stop
();
loadTest
.
setStatus
(
PerformanceTestStatus
.
Saved
.
name
());
loadTestMapper
.
updateByPrimaryKeySelective
(
loadTest
);
...
...
@@ -239,4 +239,11 @@ public class ReportService {
public
LoadTestReport
getReport
(
String
reportId
)
{
return
loadTestReportMapper
.
selectByPrimaryKey
(
reportId
);
}
public
void
updateStatus
(
String
reportId
,
String
status
)
{
LoadTestReport
report
=
new
LoadTestReport
();
report
.
setId
(
reportId
);
report
.
setStatus
(
status
);
loadTestReportMapper
.
updateByPrimaryKeySelective
(
report
);
}
}
backend/src/main/java/io/metersphere/websocket/ReportWebSocket.java
浏览文件 @
d7df95c7
...
...
@@ -84,6 +84,9 @@ public class ReportWebSocket {
session
.
close
();
break
;
}
if
(!
session
.
isOpen
())
{
return
;
}
if
(
PerformanceTestStatus
.
Running
.
name
().
equals
(
report
.
getStatus
()))
{
session
.
getBasicRemote
().
sendText
(
"refresh-"
+
this
.
refresh
++);
}
...
...
backend/src/main/resources/logback.xml
浏览文件 @
d7df95c7
...
...
@@ -146,14 +146,17 @@
</root>
<logger
name=
"io.metersphere"
additivity=
"false"
>
<level
value=
"${logger.level:INFO}"
/>
<appender-ref
ref=
"infoAsyncAppender"
/>
<appender-ref
ref=
"warnAsyncAppender"
/>
<appender-ref
ref=
"errorAsyncAppender"
/>
<level
value=
"${logger.level:INFO}"
/>
<appender-ref
ref=
"infoAsyncAppender"
/>
<appender-ref
ref=
"warnAsyncAppender"
/>
<appender-ref
ref=
"errorAsyncAppender"
/>
</logger>
<logger
name=
"io.metersphere.Application"
additivity=
"false"
level=
"${logger.level:INFO}"
>
<appender-ref
ref=
"infoAsyncAppender"
/>
<appender-ref
ref=
"infoAsyncAppender"
/>
</logger>
<logger
name=
"com.alibaba.nacos.naming.client.listener"
additivity=
"false"
level=
"ERROR"
/>
<logger
name=
"org.apache.dubbo.registry.nacos.NacosRegistry"
additivity=
"false"
level=
"ERROR"
/>
</configuration>
\ No newline at end of file
frontend/src/business/components/performance/report/PerformanceReportView.vue
浏览文件 @
d7df95c7
...
...
@@ -14,11 +14,11 @@
</el-breadcrumb>
</el-row>
<el-row
class=
"ms-report-view-btns"
>
<el-button
:disabled=
"isReadOnly || status !== 'Running'"
type=
"primary"
plain
size=
"mini"
@
click=
"
stopTest(reportId)
"
>
<el-button
:disabled=
"isReadOnly ||
report.
status !== 'Running'"
type=
"primary"
plain
size=
"mini"
@
click=
"
dialogFormVisible=true
"
>
{{
$t
(
'
report.test_stop_now
'
)
}}
</el-button>
<el-button
:disabled=
"isReadOnly || status !== 'Completed'"
type=
"success"
plain
size=
"mini"
<el-button
:disabled=
"isReadOnly ||
report.
status !== 'Completed'"
type=
"success"
plain
size=
"mini"
@
click=
"rerun(testId)"
>
{{
$t
(
'
report.test_execute_again
'
)
}}
</el-button>
...
...
@@ -62,6 +62,16 @@
</el-tabs>
</el-card>
<el-dialog
:title=
"$t('report.test_stop_now_confirm')"
:visible.sync=
"dialogFormVisible"
width=
"30%"
>
<p
v-html=
"$t('report.force_stop_tips')"
></p>
<p
v-html=
"$t('report.stop_tips')"
></p>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"danger"
size=
"small"
@
click=
"stopTest(true)"
>
{{
$t
(
'
report.force_stop_btn
'
)
}}
</el-button>
<el-button
type=
"primary"
size=
"small"
@
click=
"stopTest(false)"
>
{{
$t
(
'
report.stop_btn
'
)
}}
</el-button>
</div>
</el-dialog>
</ms-main-container>
</ms-container>
</
template
>
...
...
@@ -103,7 +113,8 @@
title
:
'
Logging
'
,
report
:
{},
isReadOnly
:
false
,
websocket
:
null
websocket
:
null
,
dialogFormVisible
:
false
,
}
},
methods
:
{
...
...
@@ -156,7 +167,7 @@
this
.
$warning
(
this
.
$t
(
'
report.generation_error
'
));
break
;
case
'
Starting
'
:
this
.
$
warning
(
this
.
$t
(
'
report.start_status
'
));
this
.
$
alert
(
this
.
$t
(
'
report.start_status
'
));
break
;
case
'
Reporting
'
:
case
'
Running
'
:
...
...
@@ -171,18 +182,16 @@
this
.
minutes
=
'
0
'
;
this
.
seconds
=
'
0
'
;
},
stopTest
(
reportId
)
{
this
.
$confirm
(
this
.
$t
(
'
report.test_stop_now_confirm
'
),
''
,
{
confirmButtonText
:
this
.
$t
(
'
commons.confirm
'
),
cancelButtonText
:
this
.
$t
(
'
commons.cancel
'
),
type
:
'
warning
'
}).
then
(()
=>
{
this
.
result
=
this
.
$get
(
'
/performance/stop/
'
+
reportId
,
()
=>
{
this
.
$success
(
this
.
$t
(
'
report.test_stop_success
'
));
stopTest
(
forceStop
)
{
this
.
result
=
this
.
$get
(
'
/performance/stop/
'
+
this
.
reportId
+
'
/
'
+
forceStop
,
()
=>
{
this
.
$success
(
this
.
$t
(
'
report.test_stop_success
'
));
if
(
forceStop
)
{
this
.
$router
.
push
(
'
/performance/report/all
'
);
})
}).
catch
(()
=>
{
});
}
else
{
this
.
report
.
status
=
'
Completed
'
;
}
})
this
.
dialogFormVisible
=
false
;
},
rerun
(
testId
)
{
this
.
$confirm
(
this
.
$t
(
'
report.test_rerun_confirm
'
),
''
,
{
...
...
@@ -190,26 +199,32 @@
cancelButtonText
:
this
.
$t
(
'
commons.cancel
'
),
type
:
'
warning
'
}).
then
(()
=>
{
this
.
result
=
this
.
$post
(
'
/performance/run
'
,
{
id
:
testId
,
triggerMode
:
'
MANUAL
'
},
()
=>
{
this
.
$success
(
this
.
$t
(
'
load_test.is_running
'
))
this
.
$router
.
push
({
path
:
'
/performance/report/all
'
})
this
.
result
=
this
.
$post
(
'
/performance/run
'
,
{
id
:
testId
,
triggerMode
:
'
MANUAL
'
},
(
response
)
=>
{
this
.
reportId
=
response
.
data
;
this
.
$router
.
push
({
path
:
'
/performance/report/view/
'
+
this
.
reportId
})
// 注册 socket
this
.
initWebSocket
();
})
}).
catch
(()
=>
{
});
},
onOpen
()
{
window
.
console
.
log
(
"
open WebSocket
"
);
window
.
console
.
log
(
"
socket opening.
"
);
},
onError
(
e
)
{
window
.
console
.
error
(
e
)
},
onMessage
(
e
)
{
this
.
$set
(
this
.
report
,
"
refresh
"
,
e
.
data
);
// 触发刷新
this
.
$set
(
this
.
report
,
"
status
"
,
'
Running
'
);
this
.
initReportTimeInfo
();
window
.
console
.
log
(
'
receive a message:
'
,
e
.
data
);
},
onClose
(
e
)
{
this
.
$set
(
this
.
report
,
"
refresh
"
,
e
.
data
);
// 触发刷新
this
.
$set
(
this
.
report
,
"
refresh
"
,
Math
.
random
());
// 触发刷新
this
.
$set
(
this
.
report
,
"
status
"
,
'
Completed
'
);
this
.
initReportTimeInfo
();
window
.
console
.
log
(
"
socket closed.
"
);
}
},
created
()
{
...
...
frontend/src/business/components/performance/report/components/ErrorLog.vue
浏览文件 @
d7df95c7
...
...
@@ -153,6 +153,9 @@
watch
:
{
report
:
{
handler
(
val
)
{
if
(
!
val
.
status
||
!
val
.
id
)
{
return
;
}
let
status
=
val
.
status
;
this
.
id
=
val
.
id
;
if
(
status
===
"
Completed
"
||
status
===
"
Running
"
)
{
...
...
frontend/src/business/components/performance/report/components/LogDetails.vue
浏览文件 @
d7df95c7
...
...
@@ -80,6 +80,9 @@
watch
:
{
report
:
{
handler
(
val
)
{
if
(
!
val
.
status
||
!
val
.
id
)
{
return
;
}
let
status
=
val
.
status
;
this
.
id
=
val
.
id
;
if
(
status
===
"
Completed
"
||
status
===
"
Running
"
)
{
...
...
frontend/src/business/components/performance/report/components/RequestStatistics.vue
浏览文件 @
d7df95c7
...
...
@@ -162,6 +162,9 @@
watch
:
{
report
:
{
handler
(
val
){
if
(
!
val
.
status
||
!
val
.
id
)
{
return
;
}
let
status
=
val
.
status
;
this
.
id
=
val
.
id
;
if
(
status
===
"
Completed
"
||
status
===
"
Running
"
)
{
...
...
frontend/src/business/components/performance/report/components/TestOverview.vue
浏览文件 @
d7df95c7
...
...
@@ -325,6 +325,9 @@
watch
:
{
report
:
{
handler
(
val
)
{
if
(
!
val
.
status
||
!
val
.
id
)
{
return
;
}
let
status
=
val
.
status
;
this
.
id
=
val
.
id
;
if
(
status
===
"
Completed
"
||
status
===
"
Running
"
)
{
...
...
frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue
浏览文件 @
d7df95c7
...
...
@@ -4,11 +4,13 @@
<el-card
v-loading=
"result.loading"
>
<el-row>
<el-col
:span=
"10"
>
<el-input
:disabled=
"isReadOnly"
:placeholder=
"$t('load_test.input_name')"
v-model=
"testPlan.name"
class=
"input-with-select"
<el-input
:disabled=
"isReadOnly"
:placeholder=
"$t('load_test.input_name')"
v-model=
"testPlan.name"
class=
"input-with-select"
maxlength=
"30"
show-word-limit
>
<template
v-slot:prepend
>
<el-select
:disabled=
"isReadOnly"
v-model=
"testPlan.projectId"
:placeholder=
"$t('load_test.select_project')"
>
<el-select
:disabled=
"isReadOnly"
v-model=
"testPlan.projectId"
:placeholder=
"$t('load_test.select_project')"
>
<el-option
v-for=
"item in projects"
:key=
"item.id"
...
...
@@ -21,10 +23,13 @@
</el-col>
<el-col
:span=
"12"
:offset=
"2"
>
<el-button
:disabled=
"isReadOnly"
type=
"primary"
plain
@
click=
"save"
>
{{$t('commons.save')}}
</el-button>
<el-button
:disabled=
"isReadOnly"
type=
"primary"
plain
@
click=
"saveAndRun"
>
{{$t('load_test.save_and_run')}}
</el-button>
<el-button
:disabled=
"isReadOnly"
type=
"primary"
plain
@
click=
"saveAndRun"
>
{{$t('load_test.save_and_run')}}
</el-button>
<el-button
:disabled=
"isReadOnly"
type=
"warning"
plain
@
click=
"cancel"
>
{{$t('commons.cancel')}}
</el-button>
<ms-schedule-config
:schedule=
"testPlan.schedule"
:save=
"saveCronExpression"
@
scheduleChange=
"saveSchedule"
:check-open=
"checkScheduleEdit"
:custom-validate=
"durationValidate"
/>
<ms-schedule-config
:schedule=
"testPlan.schedule"
:save=
"saveCronExpression"
@
scheduleChange=
"saveSchedule"
:check-open=
"checkScheduleEdit"
:custom-validate=
"durationValidate"
/>
</el-col>
</el-row>
...
...
@@ -34,7 +39,8 @@
<performance-basic-config
:is-read-only=
"isReadOnly"
:test-plan=
"testPlan"
ref=
"basicConfig"
/>
</el-tab-pane>
<el-tab-pane
:label=
"$t('load_test.pressure_config')"
>
<performance-pressure-config
:is-read-only=
"isReadOnly"
:test-plan=
"testPlan"
:test-id=
"testId"
ref=
"pressureConfig"
@
changeActive=
"changeTabActive"
/>
<performance-pressure-config
:is-read-only=
"isReadOnly"
:test-plan=
"testPlan"
:test-id=
"testId"
ref=
"pressureConfig"
@
changeActive=
"changeTabActive"
/>
</el-tab-pane>
<el-tab-pane
:label=
"$t('load_test.advanced_config')"
class=
"advanced-config"
>
<performance-advanced-config
:read-only=
"isReadOnly"
:test-id=
"testId"
ref=
"advancedConfig"
/>
...
...
@@ -67,7 +73,7 @@
data
()
{
return
{
result
:
{},
testPlan
:
{
schedule
:{}},
testPlan
:
{
schedule
:
{}},
listProjectPath
:
"
/project/listAll
"
,
savePath
:
"
/performance/save
"
,
editPath
:
"
/performance/edit
"
,
...
...
@@ -177,9 +183,9 @@
this
.
result
=
this
.
$request
(
options
,
(
response
)
=>
{
this
.
testPlan
.
id
=
response
.
data
;
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
this
.
result
=
this
.
$post
(
this
.
runPath
,
{
id
:
this
.
testPlan
.
id
,
triggerMode
:
'
MANUAL
'
},
()
=>
{
this
.
$success
(
this
.
$t
(
'
load_test.is_running
'
))
this
.
$router
.
push
({
path
:
'
/performance/report/
all
'
})
this
.
result
=
this
.
$post
(
this
.
runPath
,
{
id
:
this
.
testPlan
.
id
,
triggerMode
:
'
MANUAL
'
},
(
response
)
=>
{
let
reportId
=
response
.
data
;
this
.
$router
.
push
({
path
:
'
/performance/report/
view/
'
+
reportId
})
})
});
},
...
...
@@ -249,7 +255,7 @@
return
true
;
},
changeTabActive
(
activeName
)
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
active
=
activeName
;
});
},
...
...
frontend/src/i18n/en-US.js
浏览文件 @
d7df95c7
...
...
@@ -258,10 +258,14 @@ export default {
generation_error
:
'
Report generation error, cannot be viewed!
'
,
being_generated
:
'
Report is being generated...
'
,
delete_confirm
:
'
Confirm delete:
'
,
start_status
:
'
The test is
starting, please check the report later
!
'
,
start_status
:
'
The test is
in the beginning state, we will automatically display it on the page after we generate the report
!
'
,
run_status
:
'
The test is running, please check the report later!
'
,
user_name
:
'
Creator
'
,
project_name
:
'
Project Name
'
project_name
:
'
Project Name
'
,
force_stop_tips
:
'
<strong>Terminating</strong> the servers will immediately kill the servers and the JTL files will be lost.
'
,
stop_tips
:
'
A <strong>Graceful shutdown</strong> will archive the JTL files and then stop the servers.
'
,
force_stop_btn
:
'
Terminating
'
,
stop_btn
:
'
Graceful shutdown
'
,
},
load_test
:
{
operating
:
'
Operating
'
,
...
...
frontend/src/i18n/zh-CN.js
浏览文件 @
d7df95c7
...
...
@@ -256,11 +256,14 @@ export default {
generation_error
:
'
报告生成错误,无法查看!
'
,
being_generated
:
'
报告正在生成中...
'
,
delete_confirm
:
'
确认删除报告:
'
,
start_status
:
'
测试处于开始状态,
请稍后查看报告
!
'
,
start_status
:
'
测试处于开始状态,
我们生成报告后会自动展示到页面上
!
'
,
run_status
:
'
测试处于运行状态,请稍后查看报告!
'
,
user_name
:
'
创建人
'
,
project_name
:
'
所属项目
'
,
force_stop_tips
:
'
<strong>强制停止</strong>测试会立刻结束当前测试并删除报告数据
'
,
stop_tips
:
'
<strong>停止</strong>测试会结束当前测试并保留报告数据
'
,
force_stop_btn
:
'
强制停止
'
,
stop_btn
:
'
停止
'
,
},
load_test
:
{
operating
:
'
操作
'
,
...
...
frontend/src/i18n/zh-TW.js
浏览文件 @
d7df95c7
...
...
@@ -256,10 +256,14 @@ export default {
generation_error
:
'
報告生成錯誤,無法查看!
'
,
being_generated
:
'
報告正在生成中...
'
,
delete_confirm
:
'
確認刪除報告:
'
,
start_status
:
'
測試處於開始狀態,
請稍後查看報告
!
'
,
start_status
:
'
測試處於開始狀態,
我們生成報告後會自動展示到頁面上
!
'
,
run_status
:
'
測試處於運行狀態,請稍後查看報告!
'
,
user_name
:
'
創建人
'
,
project_name
:
'
所屬項目
'
project_name
:
'
所屬項目
'
,
force_stop_tips
:
'
<strong>強制停止</strong>測試會立刻結束當前測試並刪除報告數據
'
,
stop_tips
:
'
<strong>停止</strong>測試會結束當前測試並保留報告數據
'
,
force_stop_btn
:
'
強制停止
'
,
stop_btn
:
'
停止
'
,
},
load_test
:
{
operating
:
'
操作
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录