Files
user-system/test_verbose.txt

582 lines
32 KiB
Plaintext
Raw Normal View History

? github.com/user-management-system/cmd/server [no test files]
=== RUN TestAuthHandler_Register_MissingUsername
--- PASS: TestAuthHandler_Register_MissingUsername (0.00s)
=== RUN TestAuthHandler_Register_MissingPassword
--- PASS: TestAuthHandler_Register_MissingPassword (0.00s)
=== RUN TestAuthHandler_Register_InvalidJSON
--- PASS: TestAuthHandler_Register_InvalidJSON (0.00s)
=== RUN TestAuthHandler_Login_MissingFields
=== RUN TestAuthHandler_Login_MissingFields/空_account
=== RUN TestAuthHandler_Login_MissingFields/空_password
=== RUN TestAuthHandler_Login_MissingFields/全空
--- PASS: TestAuthHandler_Login_MissingFields (0.00s)
--- PASS: TestAuthHandler_Login_MissingFields/空_account (0.00s)
--- PASS: TestAuthHandler_Login_MissingFields/空_password (0.00s)
--- PASS: TestAuthHandler_Login_MissingFields/全空 (0.00s)
=== RUN TestAuthHandler_Login_InvalidJSON
--- PASS: TestAuthHandler_Login_InvalidJSON (0.00s)
=== RUN TestAuthHandler_RefreshToken_MissingToken
--- PASS: TestAuthHandler_RefreshToken_MissingToken (0.00s)
=== RUN TestAuthHandler_ResponseFormat
--- PASS: TestAuthHandler_ResponseFormat (0.00s)
=== RUN TestDeviceHandler_CreateDevice_InvalidJSON
--- PASS: TestDeviceHandler_CreateDevice_InvalidJSON (0.00s)
=== RUN TestDeviceHandler_UpdateDevice_InvalidID
--- PASS: TestDeviceHandler_UpdateDevice_InvalidID (0.00s)
=== RUN TestWebhookHandler_CreateWebhook_InvalidJSON
--- PASS: TestWebhookHandler_CreateWebhook_InvalidJSON (0.00s)
=== RUN TestWebhookHandler_DeleteWebhook_InvalidID
--- PASS: TestWebhookHandler_DeleteWebhook_InvalidID (0.00s)
=== RUN TestTOTPHandler_EnableTOTP_InvalidJSON
--- PASS: TestTOTPHandler_EnableTOTP_InvalidJSON (0.00s)
=== RUN TestLogHandler_GetMyLoginLogs_Unauthenticated
--- PASS: TestLogHandler_GetMyLoginLogs_Unauthenticated (0.00s)
=== RUN TestCaptchaHandler_VerifyCaptcha_InvalidJSON
--- PASS: TestCaptchaHandler_VerifyCaptcha_InvalidJSON (0.00s)
=== RUN TestPasswordResetHandler_ForgotPassword_InvalidJSON
--- PASS: TestPasswordResetHandler_ForgotPassword_InvalidJSON (0.00s)
=== RUN TestRoleHandler_CreateRole_InvalidJSON
--- PASS: TestRoleHandler_CreateRole_InvalidJSON (0.00s)
=== RUN TestRoleHandler_GetRole_InvalidID
--- PASS: TestRoleHandler_GetRole_InvalidID (0.00s)
=== RUN TestRoleHandler_UpdateRole_InvalidJSON
--- PASS: TestRoleHandler_UpdateRole_InvalidJSON (0.00s)
=== RUN TestPermissionHandler_CreatePermission_InvalidJSON
--- PASS: TestPermissionHandler_CreatePermission_InvalidJSON (0.00s)
=== RUN TestPermissionHandler_GetPermission_InvalidID
--- PASS: TestPermissionHandler_GetPermission_InvalidID (0.00s)
=== RUN TestUserHandler_GetUser_InvalidID
--- PASS: TestUserHandler_GetUser_InvalidID (0.00s)
=== RUN TestUserHandler_UpdateUser_InvalidJSON
--- PASS: TestUserHandler_UpdateUser_InvalidJSON (0.00s)
=== RUN TestUserHandler_ListUsers_Response
--- PASS: TestUserHandler_ListUsers_Response (0.00s)
=== RUN TestUserHandler_UpdatePassword_InvalidJSON
--- PASS: TestUserHandler_UpdatePassword_InvalidJSON (0.00s)
=== RUN TestUserHandler_DeleteUser_ResponseFormat
--- PASS: TestUserHandler_DeleteUser_ResponseFormat (0.00s)
PASS
ok github.com/user-management-system/internal/api/handler 3.156s
=== RUN TestIPFilter_BlockedIP_Returns403
--- PASS: TestIPFilter_BlockedIP_Returns403 (0.00s)
=== RUN TestIPFilter_NonBlockedIP_Returns200
--- PASS: TestIPFilter_NonBlockedIP_Returns200 (0.00s)
=== RUN TestIPFilter_EmptyBlacklist_AllPass
--- PASS: TestIPFilter_EmptyBlacklist_AllPass (0.00s)
=== RUN TestIPFilter_WhitelistOverridesBlacklist
--- PASS: TestIPFilter_WhitelistOverridesBlacklist (0.00s)
=== RUN TestIPFilter_CIDRBlacklist
--- PASS: TestIPFilter_CIDRBlacklist (0.00s)
=== RUN TestIPFilter_ExpiredRule_Passes
--- PASS: TestIPFilter_ExpiredRule_Passes (0.00s)
=== RUN TestIPFilter_ClientIPSetInContext
--- PASS: TestIPFilter_ClientIPSetInContext (0.00s)
=== RUN TestRealIP_XForwardedFor_PublicIP
--- PASS: TestRealIP_XForwardedFor_PublicIP (0.00s)
=== RUN TestRealIP_XForwardedFor_AllPrivate
--- PASS: TestRealIP_XForwardedFor_AllPrivate (0.00s)
=== RUN TestRealIP_XRealIP_Fallback
--- PASS: TestRealIP_XRealIP_Fallback (0.00s)
=== RUN TestRealIP_RemoteAddr_Fallback
--- PASS: TestRealIP_RemoteAddr_Fallback (0.00s)
=== RUN TestIPFilterMiddleware_GetFilter
--- PASS: TestIPFilterMiddleware_GetFilter (0.00s)
=== RUN TestIPFilter_ConcurrentRequests
--- PASS: TestIPFilter_ConcurrentRequests (0.00s)
PASS
ok github.com/user-management-system/internal/api/middleware 2.746s
? github.com/user-management-system/internal/api/router [no test files]
=== RUN TestTOTPManager_GenerateAndValidate
totp_test.go:26: 生成 Secret: AY6M5VFQKFAWUPEQ5DCWHRN64FISAFNH
totp_test.go:27: 恢复码示例: IFKKH-7ROKD
totp_test.go:37: TOTP 验证通过code=555289
--- PASS: TestTOTPManager_GenerateAndValidate (0.01s)
=== RUN TestTOTPManager_InvalidCode
totp_test.go:52: 无效验证码正确拒绝
--- PASS: TestTOTPManager_InvalidCode (0.01s)
=== RUN TestTOTPManager_RecoveryCodeFormat
--- PASS: TestTOTPManager_RecoveryCodeFormat (0.01s)
=== RUN TestValidateRecoveryCode
totp_test.go:100: 恢复码验证全部通过
--- PASS: TestValidateRecoveryCode (0.00s)
PASS
ok github.com/user-management-system/internal/auth 0.577s
? github.com/user-management-system/internal/auth/providers [no test files]
=== RUN TestRedisCache_Disabled
--- PASS: TestRedisCache_Disabled (0.00s)
=== RUN TestL1Cache_SetGet
--- PASS: TestL1Cache_SetGet (0.00s)
=== RUN TestL1Cache_Expiration
--- PASS: TestL1Cache_Expiration (0.10s)
=== RUN TestL1Cache_Delete
--- PASS: TestL1Cache_Delete (0.00s)
=== RUN TestL1Cache_Clear
--- PASS: TestL1Cache_Clear (0.00s)
=== RUN TestL1Cache_Size
--- PASS: TestL1Cache_Size (0.00s)
=== RUN TestL1Cache_Cleanup
--- PASS: TestL1Cache_Cleanup (0.06s)
=== RUN TestCacheManager_SetGet
--- PASS: TestCacheManager_SetGet (0.00s)
=== RUN TestCacheManager_Delete
--- PASS: TestCacheManager_Delete (0.00s)
=== RUN TestCacheManager_Exists
--- PASS: TestCacheManager_Exists (0.00s)
=== RUN TestCacheManager_Clear
--- PASS: TestCacheManager_Clear (0.00s)
=== RUN TestCacheManager_Concurrent
--- PASS: TestCacheManager_Concurrent (0.00s)
=== RUN TestCacheManager_WithDisabledL2
--- PASS: TestCacheManager_WithDisabledL2 (0.00s)
PASS
ok github.com/user-management-system/internal/cache 2.192s
=== RUN Test100kConcurrentLogins
concurrent_test.go:228: 开始并发测试: 大并发登录, 并发数: 1000
concurrent_test.go:235: 总请求=5119605, 成功=5119605, 失败=0, P99=31.0159ms, TPS=511720.65, 错误率=0.00%
--- PASS: Test100kConcurrentLogins (10.07s)
=== RUN Test200kConcurrentTokenValidations
concurrent_test.go:258: 总请求=8575855, P99=3.6454ms, TPS=856611.25
--- PASS: Test200kConcurrentTokenValidations (10.12s)
=== RUN TestConcurrentTokenValidation
concurrent_test.go:272: 总请求=2047307, 成功=2047307, TPS=682361.81
--- PASS: TestConcurrentTokenValidation (3.03s)
=== RUN TestConcurrentReadWrite
concurrent_test.go:306: 并发读写测试完成: 读goroutines=100, 写goroutines=20, 最终值=2000
--- PASS: TestConcurrentReadWrite (0.00s)
=== RUN TestConcurrentRegistration
concurrent_test.go:311: 跳过并发数据库测试SQLite不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestConcurrentRegistration (0.00s)
PASS
ok github.com/user-management-system/internal/concurrent 23.485s
? github.com/user-management-system/internal/config [no test files]
=== RUN TestIndexUsage
=== RUN TestIndexUsage/主键查询应使用主键索引
database_index_test.go:188: 使用索引: idx_users_username (期望: PRIMARY)
=== RUN TestIndexUsage/用户名查询应使用username索引
=== RUN TestIndexUsage/邮箱查询应使用email索引
database_index_test.go:188: 使用索引: idx_users_username (期望: idx_users_email)
=== RUN TestIndexUsage/时间范围查询应使用created_at索引
database_index_test.go:188: 使用索引: idx_users_username (期望: idx_users_created_at)
--- PASS: TestIndexUsage (0.00s)
--- PASS: TestIndexUsage/主键查询应使用主键索引 (0.00s)
--- PASS: TestIndexUsage/用户名查询应使用username索引 (0.00s)
--- PASS: TestIndexUsage/邮箱查询应使用email索引 (0.00s)
--- PASS: TestIndexUsage/时间范围查询应使用created_at索引 (0.00s)
=== RUN TestIndexSelectivity
=== RUN TestIndexSelectivity/ID列应具有高选择性
database_index_test.go:226: 列 'id' 的选择性: 100.00% (1000000/1000000)
=== RUN TestIndexSelectivity/用户名列应具有高选择性
database_index_test.go:226: 列 'username' 的选择性: 99.90% (999000/1000000)
=== RUN TestIndexSelectivity/角色列可能具有较低选择性
database_index_test.go:226: 列 'role' 的选择性: 0.00% (5/1000000)
--- PASS: TestIndexSelectivity (0.00s)
--- PASS: TestIndexSelectivity/ID列应具有高选择性 (0.00s)
--- PASS: TestIndexSelectivity/用户名列应具有高选择性 (0.00s)
--- PASS: TestIndexSelectivity/角色列可能具有较低选择性 (0.00s)
=== RUN TestIndexCovering
=== RUN TestIndexCovering/覆盖索引查询
database_index_test.go:264: 查询使用覆盖索引,包含列: id, username, email
=== RUN TestIndexCovering/非覆盖索引查询
database_index_test.go:266: 查询未使用覆盖索引,需要回表查询
--- PASS: TestIndexCovering (0.00s)
--- PASS: TestIndexCovering/覆盖索引查询 (0.00s)
--- PASS: TestIndexCovering/非覆盖索引查询 (0.00s)
=== RUN TestIndexFragmentation
=== RUN TestIndexFragmentation/用户表主键索引碎片化
database_index_test.go:299: 表 'users' 的索引 'PRIMARY' 碎片化率: 2.50%
=== RUN TestIndexFragmentation/用户表username索引碎片化
database_index_test.go:299: 表 'users' 的索引 'idx_users_username' 碎片化率: 5.30%
--- PASS: TestIndexFragmentation (0.00s)
--- PASS: TestIndexFragmentation/用户表主键索引碎片化 (0.00s)
--- PASS: TestIndexFragmentation/用户表username索引碎片化 (0.00s)
=== RUN TestIndexSize
=== RUN TestIndexSize/用户表索引大小
database_index_test.go:332: 表 'users' 的索引 'idx_users_username' 大小: 50.00 MB, 占比 25.00%
--- PASS: TestIndexSize (0.00s)
--- PASS: TestIndexSize/用户表索引大小 (0.00s)
=== RUN TestIndexRebuildPerformance
=== RUN TestIndexRebuildPerformance/重建用户表主键索引
database_index_test.go:378: 重建索引 'PRIMARY' 用时: 5.0006324s (行数: 1000000)
=== RUN TestIndexRebuildPerformance/重建用户表username索引
database_index_test.go:378: 重建索引 'idx_users_username' 用时: 5.000686s (行数: 1000000)
--- PASS: TestIndexRebuildPerformance (10.00s)
--- PASS: TestIndexRebuildPerformance/重建用户表主键索引 (5.00s)
--- PASS: TestIndexRebuildPerformance/重建用户表username索引 (5.00s)
=== RUN TestQueryPlanStability
=== RUN TestQueryPlanStability/用户ID查询
=== RUN TestQueryPlanStability/用户名查询
=== RUN TestQueryPlanStability/邮箱查询
--- PASS: TestQueryPlanStability (0.00s)
--- PASS: TestQueryPlanStability/用户ID查询 (0.00s)
--- PASS: TestQueryPlanStability/用户名查询 (0.00s)
--- PASS: TestQueryPlanStability/邮箱查询 (0.00s)
=== RUN TestFullTableScanDetection
=== RUN TestFullTableScanDetection/ID查询不应全表扫描
database_index_test.go:465: 查询正确使用索引
=== RUN TestFullTableScanDetection/LIKE前缀查询不应全表扫描
database_index_test.go:465: 查询正确使用索引
=== RUN TestFullTableScanDetection/LIKE中间查询可能全表扫描
=== RUN TestFullTableScanDetection/函数包装列会全表扫描
--- PASS: TestFullTableScanDetection (0.00s)
--- PASS: TestFullTableScanDetection/ID查询不应全表扫描 (0.00s)
--- PASS: TestFullTableScanDetection/LIKE前缀查询不应全表扫描 (0.00s)
--- PASS: TestFullTableScanDetection/LIKE中间查询可能全表扫描 (0.00s)
--- PASS: TestFullTableScanDetection/函数包装列会全表扫描 (0.00s)
=== RUN TestIndexEfficiency
=== RUN TestIndexEfficiency/精确查询应扫描少量行
database_index_test.go:500: 查询扫描/返回比: 1.00 (1/1)
=== RUN TestIndexEfficiency/范围查询应扫描适量行
database_index_test.go:500: 查询扫描/返回比: 1.00 (10000/10000)
--- PASS: TestIndexEfficiency (0.00s)
--- PASS: TestIndexEfficiency/精确查询应扫描少量行 (0.00s)
--- PASS: TestIndexEfficiency/范围查询应扫描适量行 (0.00s)
=== RUN TestCompositeIndexOrder
=== RUN TestCompositeIndexOrder/复合索引(用户名,邮箱)_-_完全匹配
=== RUN TestCompositeIndexOrder/复合索引(用户名,邮箱)_-_前缀匹配
=== RUN TestCompositeIndexOrder/复合索引(用户名,邮箱)_-_跳过列
database_index_test.go:551: 查询未使用复合索引 'idx_users_username_email' (列: [username email])
--- PASS: TestCompositeIndexOrder (0.00s)
--- PASS: TestCompositeIndexOrder/复合索引(用户名,邮箱)_-_完全匹配 (0.00s)
--- PASS: TestCompositeIndexOrder/复合索引(用户名,邮箱)_-_前缀匹配 (0.00s)
--- PASS: TestCompositeIndexOrder/复合索引(用户名,邮箱)_-_跳过列 (0.00s)
=== RUN TestIndexLocking
=== RUN TestIndexLocking/在线创建索引锁定时间
database_index_test.go:583: CREATE INDEX idx_test ON users(username) 锁定时间: 100ms
=== RUN TestIndexLocking/在线删除索引锁定时间
database_index_test.go:583: DROP INDEX idx_test ON users 锁定时间: 50ms
--- PASS: TestIndexLocking (0.00s)
--- PASS: TestIndexLocking/在线创建索引锁定时间 (0.00s)
--- PASS: TestIndexLocking/在线删除索引锁定时间 (0.00s)
=== RUN TestIndexMaintenance
=== RUN TestIndexMaintenance/ANALYZE_TABLE
database_index_test.go:640: ANALYZE TABLE 执行成功
=== RUN TestIndexMaintenance/OPTIMIZE_TABLE
database_index_test.go:645: OPTIMIZE TABLE 执行成功
=== RUN TestIndexMaintenance/CHECK_TABLE
database_index_test.go:650: CHECK TABLE 执行成功
--- PASS: TestIndexMaintenance (0.00s)
--- PASS: TestIndexMaintenance/ANALYZE_TABLE (0.00s)
--- PASS: TestIndexMaintenance/OPTIMIZE_TABLE (0.00s)
--- PASS: TestIndexMaintenance/CHECK_TABLE (0.00s)
PASS
ok github.com/user-management-system/internal/database 10.880s
=== RUN TestUserStatusConstantsExtra
--- PASS: TestUserStatusConstantsExtra (0.00s)
=== RUN TestUserModel
--- PASS: TestUserModel (0.00s)
=== RUN TestUserTableName
--- PASS: TestUserTableName (0.00s)
=== RUN TestUserStatusConstants
--- PASS: TestUserStatusConstants (0.00s)
=== RUN TestGenderConstants
--- PASS: TestGenderConstants (0.00s)
=== RUN TestUserActiveCheck
--- PASS: TestUserActiveCheck (0.00s)
PASS
ok github.com/user-management-system/internal/domain 1.824s
=== RUN TestE2ERegisterAndLogin
e2e_test.go:137: 跳过 E2E 测试SQLite 不可用): Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestE2ERegisterAndLogin (0.00s)
=== RUN TestE2ELoginFailures
e2e_test.go:205: 跳过 E2E 测试SQLite 不可用): Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestE2ELoginFailures (0.00s)
=== RUN TestE2EUnauthorizedAccess
e2e_test.go:249: 跳过 E2E 测试SQLite 不可用): Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestE2EUnauthorizedAccess (0.00s)
=== RUN TestE2EPasswordReset
e2e_test.go:270: 跳过 E2E 测试SQLite 不可用): Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestE2EPasswordReset (0.00s)
=== RUN TestE2ECaptcha
e2e_test.go:293: 跳过 E2E 测试SQLite 不可用): Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestE2ECaptcha (0.00s)
=== RUN TestE2EConcurrentLogin
e2e_test.go:333: 跳过 E2E 测试SQLite 不可用): Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestE2EConcurrentLogin (0.00s)
PASS
ok github.com/user-management-system/internal/e2e 1.048s
=== RUN TestDatabaseIntegration
integration_test.go:71: 跳过集成测试SQLite不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestDatabaseIntegration (0.00s)
=== RUN TestTransactionIntegration
integration_test.go:127: 跳过集成测试SQLite不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestTransactionIntegration (0.00s)
=== RUN TestAPIIntegration
=== RUN TestAPIIntegration/RegisterEndpoint
=== RUN TestAPIIntegration/LoginEndpoint
=== RUN TestAPIIntegration/GetUserEndpoint
--- PASS: TestAPIIntegration (0.01s)
--- PASS: TestAPIIntegration/RegisterEndpoint (0.00s)
--- PASS: TestAPIIntegration/LoginEndpoint (0.00s)
--- PASS: TestAPIIntegration/GetUserEndpoint (0.00s)
PASS
ok github.com/user-management-system/internal/integration 0.935s
=== RUN TestMiddlewarePackageExists
middleware_test.go:13: middleware package ok
--- PASS: TestMiddlewarePackageExists (0.00s)
PASS
ok github.com/user-management-system/internal/middleware 1.427s
? github.com/user-management-system/internal/models [no test files]
=== RUN TestNewMetrics
--- PASS: TestNewMetrics (0.00s)
=== RUN TestMetricsGetCollectors
--- PASS: TestMetricsGetCollectors (0.00s)
=== RUN TestIncHTTPRequest
--- PASS: TestIncHTTPRequest (0.00s)
=== RUN TestObserveHTTPRequestDuration
--- PASS: TestObserveHTTPRequestDuration (0.00s)
=== RUN TestIncDBQuery
--- PASS: TestIncDBQuery (0.00s)
=== RUN TestObserveDBQueryDuration
--- PASS: TestObserveDBQueryDuration (0.00s)
=== RUN TestIncUserRegistration
--- PASS: TestIncUserRegistration (0.00s)
=== RUN TestIncUserLogin
--- PASS: TestIncUserLogin (0.00s)
=== RUN TestSetActiveUsers
--- PASS: TestSetActiveUsers (0.00s)
=== RUN TestSetMemoryUsage
--- PASS: TestSetMemoryUsage (0.00s)
=== RUN TestSetGoroutines
--- PASS: TestSetGoroutines (0.00s)
PASS
ok github.com/user-management-system/internal/monitoring 0.312s
=== RUN TestP99LatencyThreshold
=== RUN TestP99LatencyThreshold/JWT生成P99
=== RUN TestP99LatencyThreshold/模拟用户查询P99
--- PASS: TestP99LatencyThreshold (0.26s)
--- PASS: TestP99LatencyThreshold/JWT生成P99 (0.00s)
--- PASS: TestP99LatencyThreshold/模拟用户查询P99 (0.26s)
=== RUN TestCacheHitRate
=== RUN TestCacheHitRate/用户查询缓存命中率
=== RUN TestCacheHitRate/Token验证缓存命中率
--- PASS: TestCacheHitRate (0.00s)
--- PASS: TestCacheHitRate/用户查询缓存命中率 (0.00s)
--- PASS: TestCacheHitRate/Token验证缓存命中率 (0.00s)
=== RUN TestThroughput
=== RUN TestThroughput/登录吞吐量
performance_test.go:311: 实际吞吐量: 3626.22 TPS
=== RUN TestThroughput/用户查询吞吐量
performance_test.go:311: 实际吞吐量: 19109.31 TPS
--- PASS: TestThroughput (4.00s)
--- PASS: TestThroughput/登录吞吐量 (2.00s)
--- PASS: TestThroughput/用户查询吞吐量 (2.00s)
=== RUN TestMemoryUsage
performance_test.go:333: 内存变化: 0.02 MB
--- PASS: TestMemoryUsage (0.21s)
=== RUN TestGCPressure
performance_test.go:350: 平均GC停顿: 5.55 ms
--- PASS: TestGCPressure (0.11s)
=== RUN TestConnectionPool
performance_test.go:375: 连接池复用分布: max=100, min=100
--- PASS: TestConnectionPool (0.00s)
=== RUN TestResourceLeak
performance_test.go:392: Goroutine数量变化: 0
--- PASS: TestResourceLeak (0.20s)
PASS
ok github.com/user-management-system/internal/performance 7.156s
? github.com/user-management-system/internal/pkg/errors [no test files]
=== RUN TestUserRepository_Create
user_repository_test.go:13: 跳过数据库测试SQLite不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestUserRepository_Create (0.00s)
=== RUN TestUserRepository_GetByUsername
user_repository_test.go:13: 跳过数据库测试SQLite不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestUserRepository_GetByUsername (0.00s)
=== RUN TestUserRepository_GetByEmail
user_repository_test.go:13: 跳过数据库测试SQLite不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestUserRepository_GetByEmail (0.00s)
=== RUN TestUserRepository_Update
user_repository_test.go:13: 跳过数据库测试SQLite不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestUserRepository_Update (0.00s)
=== RUN TestUserRepository_Delete
user_repository_test.go:13: 跳过数据库测试SQLite不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestUserRepository_Delete (0.00s)
=== RUN TestUserRepository_ExistsBy
user_repository_test.go:13: 跳过数据库测试SQLite不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestUserRepository_ExistsBy (0.00s)
=== RUN TestUserRepository_List
user_repository_test.go:13: 跳过数据库测试SQLite不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestUserRepository_List (0.00s)
PASS
ok github.com/user-management-system/internal/repository 3.576s
? github.com/user-management-system/internal/response [no test files]
=== RUN TestRobustnessErrorScenarios
=== RUN TestRobustnessErrorScenarios/NullPointerProtection
--- PASS: TestRobustnessErrorScenarios (0.00s)
--- PASS: TestRobustnessErrorScenarios/NullPointerProtection (0.00s)
=== RUN TestRobustnessConcurrency
=== RUN TestRobustnessConcurrency/ConcurrentUserCreation
robustness_test.go:59: 并发创建完成,错误数: 0
=== RUN TestRobustnessConcurrency/ConcurrentLogin
robustness_test.go:84: 并发登录: 50/50 成功
=== RUN TestRobustnessConcurrency/RaceConditionTest
robustness_test.go:111: 竞态条件测试完成, username: user6
--- PASS: TestRobustnessConcurrency (0.00s)
--- PASS: TestRobustnessConcurrency/ConcurrentUserCreation (0.00s)
--- PASS: TestRobustnessConcurrency/ConcurrentLogin (0.00s)
--- PASS: TestRobustnessConcurrency/RaceConditionTest (0.00s)
=== RUN TestRobustnessResourceLimits
=== RUN TestRobustnessResourceLimits/RateLimiting
robustness_test.go:133: 限流测试: 10 成功, 90 失败
--- PASS: TestRobustnessResourceLimits (0.00s)
--- PASS: TestRobustnessResourceLimits/RateLimiting (0.00s)
=== RUN TestRobustnessFaultTolerance
=== RUN TestRobustnessFaultTolerance/CacheFailureFallback
robustness_test.go:153: 从数据库获取用户成功: 1
=== RUN TestRobustnessFaultTolerance/RetryMechanism
robustness_test.go:175: 重试 3 次后成功
=== RUN TestRobustnessFaultTolerance/CircuitBreaker
--- PASS: TestRobustnessFaultTolerance (6.30s)
--- PASS: TestRobustnessFaultTolerance/CacheFailureFallback (0.00s)
--- PASS: TestRobustnessFaultTolerance/RetryMechanism (0.30s)
--- PASS: TestRobustnessFaultTolerance/CircuitBreaker (6.00s)
=== RUN TestStressScenarios
=== RUN TestStressScenarios/HighConcurrentRequests
robustness_test.go:225: 处理 1000 个并发请求耗时: 12.9128ms
robustness_test.go:226: 平均每个请求: 12.912µs
--- PASS: TestStressScenarios (0.01s)
--- PASS: TestStressScenarios/HighConcurrentRequests (0.01s)
PASS
ok github.com/user-management-system/internal/robustness 7.540s
=== RUN TestIPFilter_BlacklistBasic
ip_filter_test.go:32: 正确封禁reason=测试封禁
--- PASS: TestIPFilter_BlacklistBasic (0.00s)
=== RUN TestIPFilter_BlacklistExpiry
ip_filter_test.go:55: 过期解封正常
--- PASS: TestIPFilter_BlacklistExpiry (0.10s)
=== RUN TestIPFilter_WhitelistOverridesBlacklist
ip_filter_test.go:69: 白名单优先级验证通过
--- PASS: TestIPFilter_WhitelistOverridesBlacklist (0.00s)
=== RUN TestIPFilter_CIDRMatch
--- PASS: TestIPFilter_CIDRMatch (0.00s)
=== RUN TestIPFilter_InvalidIP
ip_filter_test.go:104: 无效 IP 错误: 无效的 IP 或 CIDR 格式: not-an-ip
--- PASS: TestIPFilter_InvalidIP (0.00s)
=== RUN TestIPFilter_RemoveFromBlacklist
--- PASS: TestIPFilter_RemoveFromBlacklist (0.00s)
=== RUN TestAnomalyDetector_BruteForce
ip_filter_test.go:154: 暴力破解检测正常触发
ip_filter_test.go:161: IP 自动封禁验证通过
--- PASS: TestAnomalyDetector_BruteForce (0.00s)
=== RUN TestAnomalyDetector_MultipleIPs
ip_filter_test.go:194: 多 IP 检测正常触发
--- PASS: TestAnomalyDetector_MultipleIPs (0.00s)
=== RUN TestAnomalyDetector_GetRecentLogins
--- PASS: TestAnomalyDetector_GetRecentLogins (0.00s)
=== RUN TestValidateIPOrCIDR
--- PASS: TestValidateIPOrCIDR (0.00s)
PASS
ok github.com/user-management-system/internal/security 1.730s
=== RUN TestRegister_Success
--- PASS: TestRegister_Success (0.07s)
=== RUN TestRegister_DuplicateUsername
--- PASS: TestRegister_DuplicateUsername (0.07s)
=== RUN TestRegister_DuplicateEmail
--- PASS: TestRegister_DuplicateEmail (0.06s)
=== RUN TestLogin_Success
--- PASS: TestLogin_Success (0.13s)
=== RUN TestLogin_WrongPassword
--- PASS: TestLogin_WrongPassword (0.13s)
=== RUN TestLogin_UserNotFound
--- PASS: TestLogin_UserNotFound (0.00s)
=== RUN TestLogin_DisabledUser
--- PASS: TestLogin_DisabledUser (0.07s)
=== RUN TestCaptchaService_Generate
--- PASS: TestCaptchaService_Generate (0.00s)
=== RUN TestCaptchaService_Verify_WrongAnswer
--- PASS: TestCaptchaService_Verify_WrongAnswer (0.00s)
=== RUN TestCaptchaService_Verify_EmptyInputs
--- PASS: TestCaptchaService_Verify_EmptyInputs (0.00s)
=== RUN TestCaptchaService_ValidateCaptcha_EmptyID
--- PASS: TestCaptchaService_ValidateCaptcha_EmptyID (0.00s)
=== RUN TestCaptchaService_Generate_UniqueIDs
--- PASS: TestCaptchaService_Generate_UniqueIDs (0.01s)
=== RUN TestDeviceService_CreateAndList
device_service_test.go:30: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestDeviceService_CreateAndList (0.00s)
=== RUN TestDeviceService_DeleteDevice
device_service_test.go:68: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestDeviceService_DeleteDevice (0.00s)
=== RUN TestDeviceService_UpdateDeviceStatus
device_service_test.go:93: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestDeviceService_UpdateDeviceStatus (0.00s)
=== RUN TestLoginLogService_RecordAndList
log_service_test.go:30: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestLoginLogService_RecordAndList (0.00s)
=== RUN TestLoginLogService_RecordFailedLogin
log_service_test.go:61: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestLoginLogService_RecordFailedLogin (0.00s)
=== RUN TestOperationLogService_RecordAndList
log_service_test.go:79: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestOperationLogService_RecordAndList (0.00s)
=== RUN TestPermissionService_CreateAndList
permission_service_test.go:30: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestPermissionService_CreateAndList (0.00s)
=== RUN TestPermissionService_DuplicateCode
permission_service_test.go:59: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestPermissionService_DuplicateCode (0.00s)
=== RUN TestPermissionService_GetAndUpdate
permission_service_test.go:75: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestPermissionService_GetAndUpdate (0.00s)
=== RUN TestPermissionService_Delete
permission_service_test.go:98: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestPermissionService_Delete (0.00s)
=== RUN TestRoleService_CreateAndGet
role_service_test.go:30: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestRoleService_CreateAndGet (0.00s)
=== RUN TestRoleService_DuplicateCode
role_service_test.go:58: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestRoleService_DuplicateCode (0.00s)
=== RUN TestRoleService_ListRoles
role_service_test.go:74: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestRoleService_ListRoles (0.00s)
=== RUN TestRoleService_UpdateRole
role_service_test.go:98: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestRoleService_UpdateRole (0.00s)
=== RUN TestRoleService_DeleteRole
role_service_test.go:118: SQLite 不可用: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestRoleService_DeleteRole (0.00s)
=== RUN TestTOTPManager_GenerateSecret
--- PASS: TestTOTPManager_GenerateSecret (0.01s)
=== RUN TestTOTPManager_Verify_ValidCode
--- PASS: TestTOTPManager_Verify_ValidCode (0.01s)
=== RUN TestTOTPManager_Verify_InvalidCode
--- PASS: TestTOTPManager_Verify_InvalidCode (0.01s)
=== RUN TestTOTPService_GetTOTPStatus_Disabled
--- PASS: TestTOTPService_GetTOTPStatus_Disabled (0.00s)
=== RUN TestTOTPService_GetTOTPStatus_Enabled
--- PASS: TestTOTPService_GetTOTPStatus_Enabled (0.00s)
=== RUN TestTOTPManager_RecoveryCodesFormat
--- PASS: TestTOTPManager_RecoveryCodesFormat (0.01s)
=== RUN TestValidateRecoveryCode
--- PASS: TestValidateRecoveryCode (0.00s)
=== RUN TestUserRepo_GetUser_NotFound
--- PASS: TestUserRepo_GetUser_NotFound (0.00s)
=== RUN TestUserRepo_EmailConflictDetection
--- PASS: TestUserRepo_EmailConflictDetection (0.00s)
=== RUN TestUserRepo_DeleteUser
--- PASS: TestUserRepo_DeleteUser (0.00s)
=== RUN TestUserRepo_UpdateStatus
--- PASS: TestUserRepo_UpdateStatus (0.00s)
=== RUN TestUserRepo_List_Pagination
--- PASS: TestUserRepo_List_Pagination (0.00s)
=== RUN TestUserRepo_ListByStatus
--- PASS: TestUserRepo_ListByStatus (0.00s)
=== RUN TestWebhookService_CreateAndList
webhook_service_test.go:33: SQLite 不可用,跳过测试: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestWebhookService_CreateAndList (0.00s)
=== RUN TestWebhookService_Update
webhook_service_test.go:63: SQLite 不可用,跳过测试: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestWebhookService_Update (0.00s)
=== RUN TestWebhookService_Delete
webhook_service_test.go:85: SQLite 不可用,跳过测试: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestWebhookService_Delete (0.00s)
=== RUN TestWebhookService_Publish_DeliveryRecord
webhook_service_test.go:117: SQLite 不可用,跳过测试: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
--- SKIP: TestWebhookService_Publish_DeliveryRecord (0.00s)
=== RUN TestWebhookSubscribesTo
--- PASS: TestWebhookSubscribesTo (0.00s)
PASS
ok github.com/user-management-system/internal/service 1.557s
? github.com/user-management-system/pkg/errors [no test files]
? github.com/user-management-system/pkg/response [no test files]