- Implemented TUI auto-select for automated testing - Fixed TUI automation: autoSelectMsg handling in Update() - Auto-database selection in DatabaseSelector - Created focused test suite (test_as_postgres.sh) - Created retention policy test (test_retention.sh) - All 10 security tests passing Features validated: ✅ Backup retention policy (30 days, min backups) ✅ Rate limiting (exponential backoff) ✅ Privilege checks (root detection) ✅ Resource limit validation ✅ Path sanitization ✅ Checksum verification (SHA-256) ✅ Audit logging ✅ Secure permissions ✅ Configuration persistence ✅ TUI automation framework Test results: 10/10 passed Backup files created with .dump, .sha256, .info Retention cleanup verified (old files removed)
29 lines
643 B
Go
Executable File
29 lines
643 B
Go
Executable File
package checks
|
|
|
|
import "fmt"
|
|
|
|
// DiskSpaceCheck represents disk space information
|
|
type DiskSpaceCheck struct {
|
|
Path string
|
|
TotalBytes uint64
|
|
AvailableBytes uint64
|
|
UsedBytes uint64
|
|
UsedPercent float64
|
|
Sufficient bool
|
|
Warning bool
|
|
Critical bool
|
|
}
|
|
|
|
// formatBytes formats bytes to human-readable format
|
|
func formatBytes(bytes uint64) string {
|
|
const unit = 1024
|
|
if bytes < unit {
|
|
return fmt.Sprintf("%d B", bytes)
|
|
}
|
|
div, exp := uint64(unit), 0
|
|
for n := bytes / unit; n >= unit; n /= unit {
|
|
div *= unit
|
|
exp++
|
|
}
|
|
return fmt.Sprintf("%.1f %ciB", float64(bytes)/float64(div), "KMGTPE"[exp])
|
|
} |