feat: 完善系统配置审计通知功能并优化异常处理

- 新增异常处理体系(BaseException及其子类)
- 优化密码、邮箱、用户名等基础类型
- 添加字典管理、登录日志、操作日志的E2E测试
- 完善API集成测试和安全测试
- 添加性能测试配置和脚本
- 优化OpenAPI配置和全局异常处理器
This commit is contained in:
张翔
2026-03-24 14:05:35 +08:00
parent be5d5ede90
commit e4721053bd
47 changed files with 3006 additions and 816 deletions
+148 -30
View File
@@ -1,36 +1,154 @@
{
"scenarios": {
"baseline": {
"executor": "constant-vus",
"vus": 10,
"duration": "30s"
"name": "Novalon管理系统性能测试",
"stages": [
{
"name": "预热阶段",
"duration": "2m",
"target": 10,
"description": "2分钟内增加到10个虚拟用户"
},
"stress_test": {
"executor": "ramping-vus",
"startVUs": 10,
"stages": [
{ "duration": "1m", "target": 50 },
{ "duration": "2m", "target": 100 },
{ "duration": "1m", "target": 50 },
{ "duration": "1m", "target": 10 }
]
{
"name": "稳定阶段1",
"duration": "5m",
"target": 10,
"description": "保持10个虚拟用户5分钟"
},
"spike_test": {
"executor": "ramping-vus",
"startVUs": 10,
"stages": [
{ "duration": "30s", "target": 10 },
{ "duration": "10s", "target": 200 },
{ "duration": "30s", "target": 10 }
]
{
"name": "负载增加阶段",
"duration": "2m",
"target": 50,
"description": "2分钟内增加到50个虚拟用户"
},
{
"name": "稳定阶段2",
"duration": "5m",
"target": 50,
"description": "保持50个虚拟用户5分钟"
},
{
"name": "高负载阶段",
"duration": "2m",
"target": 100,
"description": "2分钟内增加到100个虚拟用户"
},
{
"name": "稳定阶段3",
"duration": "5m",
"target": 100,
"description": "保持100个虚拟用户5分钟"
},
{
"name": "冷却阶段",
"duration": "2m",
"target": 0,
"description": "2分钟内降到0个虚拟用户"
}
],
"thresholds": {
"http_req_duration": {
"p95": "<500",
"p99": "<1000",
"description": "95%的请求响应时间<500ms99%的请求响应时间<1000ms"
},
"http_req_failed": {
"rate": "<0.01",
"description": "错误率<1%"
},
"http_reqs": {
"rate": ">100",
"description": "请求速率>100请求/秒"
}
},
"thresholds": {
"http_req_duration": [
{ "target": "p(95)<500", "abortOnFail": true }
],
"http_req_failed": [
{ "target": "rate<0.05", "abortOnFail": true }
]
"endpoints": [
{
"name": "健康检查",
"method": "GET",
"path": "/actuator/health",
"expected_status": 200,
"max_duration": 100,
"description": "后端健康检查接口"
},
{
"name": "登录",
"method": "POST",
"path": "/api/auth/login",
"expected_status": 200,
"max_duration": 500,
"description": "用户登录接口"
},
{
"name": "用户列表",
"method": "GET",
"path": "/api/users?page=0&size=10",
"expected_status": 200,
"max_duration": 300,
"description": "获取用户列表接口"
},
{
"name": "角色列表",
"method": "GET",
"path": "/api/roles?page=0&size=10",
"expected_status": 200,
"max_duration": 300,
"description": "获取角色列表接口"
},
{
"name": "字典列表",
"method": "GET",
"path": "/api/dicts?page=0&size=10",
"expected_status": 200,
"max_duration": 300,
"description": "获取字典列表接口"
},
{
"name": "系统配置",
"method": "GET",
"path": "/api/configs?page=0&size=10",
"expected_status": 200,
"max_duration": 300,
"description": "获取系统配置接口"
},
{
"name": "通知列表",
"method": "GET",
"path": "/api/notices?page=0&size=10",
"expected_status": 200,
"max_duration": 300,
"description": "获取通知列表接口"
},
{
"name": "操作日志",
"method": "GET",
"path": "/api/operation-logs?page=0&size=10",
"expected_status": 200,
"max_duration": 300,
"description": "获取操作日志接口"
}
],
"scenarios": {
"basic": {
"name": "基础性能测试",
"description": "测试系统在低负载下的性能表现",
"stages": ["预热阶段", "稳定阶段1", "冷却阶段"],
"endpoints": ["健康检查", "登录", "用户列表"]
},
"moderate": {
"name": "中等负载测试",
"description": "测试系统在中负载下的性能表现",
"stages": ["预热阶段", "稳定阶段1", "负载增加阶段", "稳定阶段2", "冷却阶段"],
"endpoints": ["健康检查", "登录", "用户列表", "角色列表", "字典列表"]
},
"high": {
"name": "高负载测试",
"description": "测试系统在高负载下的性能表现",
"stages": ["预热阶段", "稳定阶段1", "负载增加阶段", "稳定阶段2", "高负载阶段", "稳定阶段3", "冷却阶段"],
"endpoints": ["健康检查", "登录", "用户列表", "角色列表", "字典列表", "系统配置", "通知列表", "操作日志"]
},
"stress": {
"name": "压力测试",
"description": "测试系统在极限负载下的性能表现",
"stages": ["高负载阶段", "稳定阶段3", "冷却阶段"],
"endpoints": ["健康检查", "登录", "用户列表", "角色列表", "字典列表", "系统配置", "通知列表", "操作日志"]
}
}
}
}