Some checks failed
Build and Deploy Log Center / build-and-deploy (push) Failing after 5m9s
56 lines
4.6 KiB
SQL
56 lines
4.6 KiB
SQL
-- 测试Bug数据 - 用于演示完整修复流程
|
||
-- 执行方式:psql -h pgm-7xv4811oj11j86htzo.pg.rds.aliyuncs.com -U log_center -d log_center -f test_bugs.sql
|
||
|
||
-- Bug 1: 简单拼写错误(NEW)
|
||
INSERT INTO errorlog (project_id, environment, level, source, error_type, error_message, file_path, line_number, stack_trace, context, status, fingerprint, timestamp, retry_count)
|
||
VALUES ('rtc_backend', 'production', 'ERROR', 'runtime', 'NameError', 'name ''usre_id'' is not defined',
|
||
'app/services/user_service.py', 45, 'NameError: name ''usre_id'' is not defined at line 45',
|
||
'{"typo": "usre_id"}', 'NEW', 'bug_typo_001', NOW() - INTERVAL '1 day', 0);
|
||
|
||
-- Bug 2: 空指针(NEW)
|
||
INSERT INTO errorlog (project_id, environment, level, source, error_type, error_message, file_path, line_number, stack_trace, context, status, fingerprint, timestamp, retry_count)
|
||
VALUES ('rtc_backend', 'production', 'ERROR', 'runtime', 'AttributeError', '''None Type'' object has no attribute ''id''',
|
||
'app/api/device_api.py', 89, 'AttributeError at line 89',
|
||
'{"device_sn": "BRAND-P01-999"}', 'NEW', 'bug_null_002', NOW() - INTERVAL '2 days', 0);
|
||
|
||
-- Bug 3: 列表越界(有PR待审核)
|
||
INSERT INTO errorlog (project_id, environment, level, source, error_type, error_message, file_path, line_number, stack_trace, context, status, fingerprint, pr_url, pr_number, branch_name, timestamp, retry_count)
|
||
VALUES ('rtc_backend', 'production', 'ERROR', 'runtime', 'IndexError', 'list index out of range',
|
||
'app/utils/data_processor.py', 127, 'IndexError at line 127',
|
||
'{"batch_size": 0}', 'PENDING_FIX', 'bug_index_003',
|
||
'https://gitea.airlabs.art/qiyuan/rtc_backend/pulls/301', 301, 'fix/auto-indexerror',
|
||
NOW() - INTERVAL '3 days', 0);
|
||
|
||
-- Bug 4: 支付逻辑错误(高级,有PR)
|
||
INSERT INTO errorlog (project_id, environment, level, source, error_type, error_message, file_path, line_number, stack_trace, context, status, fingerprint, pr_url, pr_number, branch_name, timestamp, retry_count)
|
||
VALUES ('rtc_backend', 'production', 'CRITICAL', 'runtime', 'PaymentLogicError', '支付金额计算错误:折扣后金额为负数',
|
||
'app/services/payment_service.py', 234, 'PaymentLogicError at line 234',
|
||
'{"original_price": 99.0, "discount": 120.0}', 'PENDING_FIX', 'bug_payment_004',
|
||
'https://gitea.airlabs.art/qiyuan/rtc_backend/pulls/302', 302, 'fix/auto-payment-logic',
|
||
NOW() - INTERVAL '4 days', 0);
|
||
|
||
-- Bug 5: 并发问题(高级,有PR)
|
||
INSERT INTO errorlog (project_id, environment, level, source, error_type, error_message, file_path, line_number, stack_trace, context, status, fingerprint, pr_url, pr_number, branch_name, timestamp, retry_count)
|
||
VALUES ('rtc_backend', 'production', 'CRITICAL', 'runtime', 'DatabaseIntegrityError', '用户积分并发更新冲突',
|
||
'app/services/points_service.py', 156, 'DatabaseIntegrityError: race condition',
|
||
'{"user_id": 12345, "add_amount": 100}', 'PENDING_FIX', 'bug_concurrency_005',
|
||
'https://gitea.airlabs.art/qiyuan/rtc_backend/pulls/303', 303, 'fix/auto-points-race',
|
||
NOW() - INTERVAL '5 days', 0);
|
||
|
||
-- Bug 6: 已修复(已合并)
|
||
INSERT INTO errorlog (project_id, environment, level, source, error_type, error_message, file_path, line_number, stack_trace, context, status, fingerprint, pr_url, pr_number, branch_name, merged_at, timestamp, retry_count)
|
||
VALUES ('rtc_backend', 'production', 'WARNING', 'runtime', 'KeyError', 'Key ''age'' not found',
|
||
'app/utils/validator.py', 67, 'KeyError: ''age'' at line 67',
|
||
'{"keys": ["name", "email"]}', 'FIXED', 'bug_keyerror_006',
|
||
'https://gitea.airlabs.art/qiyuan/rtc_backend/pulls/300', 300, 'fix/auto-keyerror',
|
||
NOW() - INTERVAL '2 hours', NOW() - INTERVAL '6 days', 0);
|
||
|
||
-- Bug 7: 被拒绝的(有PR,已拒绝1次)
|
||
INSERT INTO errorlog (project_id, environment, level, source, error_type, error_message, file_path, line_number, stack_trace, context, status, fingerprint, pr_url, pr_number, branch_name, rejection_count, rejection_reason, last_rejected_at, timestamp, retry_count)
|
||
VALUES ('rtc_backend', 'production', 'ERROR', 'runtime', 'ValidationError', '手机号格式验证失败',
|
||
'app/validators/phone_validator.py', 23, 'ValidationError: invalid phone format',
|
||
'{"phone": "12345"}', 'PENDING_FIX', 'bug_phone_007',
|
||
'https://gitea.airlabs.art/qiyuan/rtc_backend/pulls/304', 304, 'fix/auto-phone-validation',
|
||
1, '{"reason": "测试覆盖不足,缺少边界条件测试", "rejected_at": "2026-02-25T02:00:00"}',
|
||
NOW() - INTERVAL '1 hour', NOW() - INTERVAL '7 days', 0);
|