perhapzz
|
0276554d9c
|
test(fileutil,health): add unit tests for WriteFileAtomic and health server
Add comprehensive test coverage for two previously untested packages:
pkg/fileutil (9 tests):
- Basic write and read-back
- File permissions (0600)
- Overwrite existing files
- Empty data handling
- Nested directory auto-creation
- No temp files left after success
- Large file (1MB) handling
- Concurrent write safety
- Invalid path error handling
pkg/health (15 tests):
- Health endpoint returns 200 with status, uptime, pid
- Ready endpoint returns 503 when not ready
- Ready endpoint returns 200 when ready
- Ready fails when any registered check fails
- Ready passes with all checks passing
- Reload rejects non-POST methods
- Reload returns 503 when no reload func set
- Reload calls registered function on success
- Reload returns 500 on function error
- SetReady toggle behavior
- Multiple health checks interaction
- RegisterOnMux works with custom ServeMux
- NewServer defaults
- StartContext graceful shutdown on cancel
- statusString helper
|
2026-03-20 10:41:08 +00:00 |
|