chore:push

This commit is contained in:
2025-11-10 13:18:04 +00:00
parent 4c4126d5d3
commit be873ead5c
3 changed files with 0 additions and 2742 deletions

View File

@@ -1,251 +0,0 @@
# DBBackup Comprehensive Test Plan
**Date**: November 10, 2025
**Goal**: Test all command-line and interactive functions to ensure stability
## Issues Found
### 🐛 BUG #1: `--create` flag not implemented in single database restore
**Severity**: HIGH
**Location**: `internal/restore/engine.go` - `RestoreSingle()` function
**Description**: The `createIfMissing` parameter is accepted but never used. Function doesn't create target database.
**Expected**: When `--create` flag is used, should create database if it doesn't exist
**Actual**: Fails with "database does not exist" error
**Fix Required**: Add database creation logic before restore
---
## Test Matrix
### 1. BACKUP OPERATIONS
#### 1.1 Single Database Backup
| Test Case | Command | Expected Result | Status |
|-----------|---------|-----------------|--------|
| Basic backup | `backup single ownership_test` | ✅ Success | ✅ PASS |
| With compression level | `backup single ownership_test --compression=9` | Success with higher compression | ⏳ TODO |
| With custom backup dir | `backup single ownership_test --backup-dir=/tmp/backups` | Success, file in /tmp/backups | ⏳ TODO |
| Non-existent database | `backup single nonexistent_db` | Error: database does not exist | ⏳ TODO |
| Without permissions | `backup single postgres` (as non-postgres user) | Error: authentication failed | ⏳ TODO |
#### 1.2 Cluster Backup
| Test Case | Command | Expected Result | Status |
|-----------|---------|-----------------|--------|
| Basic cluster backup | `backup cluster` | ✅ Success, all DBs backed up | ✅ PASS |
| With parallel jobs | `backup cluster --jobs=4` | Success with 4 parallel jobs | ⏳ TODO |
| With custom compression | `backup cluster --compression=1` | Fast backup, larger file | ⏳ TODO |
| Disk space insufficient | `backup cluster` (low disk space) | Error: insufficient disk space | ⏳ TODO |
---
### 2. RESTORE OPERATIONS
#### 2.1 Single Database Restore
| Test Case | Command | Expected Result | Status |
|-----------|---------|-----------------|--------|
| Basic restore | `restore single backup.dump --target=test_db --confirm` | Database exists: Success | ⏳ TODO |
| With --create flag | `restore single backup.dump --target=new_db --create --confirm` | ❌ BUG: Database not created | ❌ **BUG #1** |
| With --clean flag | `restore single backup.dump --target=existing_db --clean --confirm` | Drop + Restore success | ⏳ TODO |
| Dry-run mode | `restore single backup.dump --target=test_db --dry-run` | Show plan, no changes | ⏳ TODO |
| Without --confirm | `restore single backup.dump --target=test_db` | Show dry-run automatically | ⏳ TODO |
| Non-existent file | `restore single /tmp/nonexistent.dump --confirm` | Error: file not found | ⏳ TODO |
| Corrupted archive | `restore single corrupted.dump --confirm` | Error: invalid archive | ⏳ TODO |
| Wrong format | `restore single cluster.tar.gz --confirm` | Error: not a single DB backup | ⏳ TODO |
#### 2.2 Cluster Restore
| Test Case | Command | Expected Result | Status |
|-----------|---------|-----------------|--------|
| Basic cluster restore | `restore cluster backup.tar.gz --confirm` | ✅ All DBs restored with ownership | ✅ PASS |
| Dry-run mode | `restore cluster backup.tar.gz --dry-run` | Show restore plan | ⏳ TODO |
| Without --confirm | `restore cluster backup.tar.gz` | Show dry-run automatically | ⏳ TODO |
| Non-superuser | `restore cluster backup.tar.gz --confirm` (non-superuser) | Warning: limited ownership | ⏳ TODO |
| Disk space insufficient | `restore cluster backup.tar.gz --confirm` | Error: insufficient disk space | ⏳ TODO |
| With --force flag | `restore cluster backup.tar.gz --force --confirm` | Skip safety checks | ⏳ TODO |
#### 2.3 Restore List
| Test Case | Command | Expected Result | Status |
|-----------|---------|-----------------|--------|
| List all backups | `restore list` | ✅ Show all backup files | ✅ PASS |
| List with filter | `restore list --database=test_db` | Show only test_db backups | ⏳ TODO |
| Empty backup dir | `restore list` (no backups) | Show "No backups found" | ⏳ TODO |
---
### 3. STATUS OPERATIONS
| Test Case | Command | Expected Result | Status |
|-----------|---------|-----------------|--------|
| Basic status | `status` | Show database list | ⏳ TODO |
| Detailed status | `status --detailed` | Show with sizes/counts | ⏳ TODO |
| JSON format | `status --format=json` | Valid JSON output | ⏳ TODO |
| Filter by database | `status --database=test_db` | Show only test_db | ⏳ TODO |
---
### 4. INTERACTIVE MODE (TUI)
#### 4.1 Main Menu Navigation
| Test Case | Action | Expected Result | Status |
|-----------|--------|-----------------|--------|
| Launch TUI | `./dbbackup` or `./dbbackup interactive` | Show main menu | ⏳ TODO |
| Navigate with arrows | Up/Down arrows | Highlight moves | ⏳ TODO |
| Select with Enter | Enter key on option | Execute option | ⏳ TODO |
| Quit with q | Press 'q' | Exit gracefully | ⏳ TODO |
| Ctrl+C handling | Press Ctrl+C | Exit gracefully | ⏳ TODO |
#### 4.2 Backup Single Database (TUI)
| Test Case | Action | Expected Result | Status |
|-----------|--------|-----------------|--------|
| Select database | Choose from list | Database selected | ⏳ TODO |
| Confirm backup | Confirm dialog | Backup starts | ⏳ TODO |
| Cancel backup | Cancel dialog | Return to menu | ⏳ TODO |
| Progress display | During backup | Show progress bar | ⏳ TODO |
| Completion message | After success | Show success message | ⏳ TODO |
| Error handling | Backup fails | Show error, don't crash | ⏳ TODO |
#### 4.3 Backup Cluster (TUI)
| Test Case | Action | Expected Result | Status |
|-----------|--------|-----------------|--------|
| Confirm cluster backup | Confirm dialog | Backup all DBs | ⏳ TODO |
| Progress tracking | During backup | Show N/M databases | ⏳ TODO |
| ETA display | Long operation | Show time remaining | ⏳ TODO |
| Error on one DB | One DB fails | Continue with others | ⏳ TODO |
#### 4.4 Restore Single Database (TUI)
| Test Case | Action | Expected Result | Status |
|-----------|--------|-----------------|--------|
| Select archive | Choose from list | Archive selected | ⏳ TODO |
| Select target DB | Choose/enter name | Target selected | ⏳ TODO |
| Confirm restore | Confirm dialog | Restore starts | ⏳ TODO |
| Cancel restore | Cancel dialog | Return to menu | ⏳ TODO |
| Progress display | During restore | Show progress | ⏳ TODO |
#### 4.5 Restore Cluster (TUI)
| Test Case | Action | Expected Result | Status |
|-----------|--------|-----------------|--------|
| Select cluster archive | Choose from list | Archive selected | ⏳ TODO |
| Confirm restore | Warning + confirm | Restore starts | ⏳ TODO |
| Progress tracking | During restore | Show N/M databases | ⏳ TODO |
| Ownership preservation | After restore | Verify owners correct | ⏳ TODO |
#### 4.6 View Status (TUI)
| Test Case | Action | Expected Result | Status |
|-----------|--------|-----------------|--------|
| Show all databases | Select status option | List all DBs | ⏳ TODO |
| Scroll long lists | Arrow keys | Scroll works | ⏳ TODO |
| Return to menu | Back/Escape | Return to main menu | ⏳ TODO |
#### 4.7 Operation History (TUI)
| Test Case | Action | Expected Result | Status |
|-----------|--------|-----------------|--------|
| View history | Select history option | Show past operations | ⏳ TODO |
| Navigate history | Up/Down arrows | Scroll through history | ⏳ TODO |
| Long operations | View 2-hour backup | Show correct duration | ⏳ TODO |
| Empty history | First run | Show "No history" | ⏳ TODO |
---
### 5. EDGE CASES & ERROR SCENARIOS
#### 5.1 Authentication & Permissions
| Test Case | Scenario | Expected Result | Status |
|-----------|----------|-----------------|--------|
| Peer auth mismatch | Run as root with --user postgres | Show warning, suggest sudo | ⏳ TODO |
| No password | Connect with peer auth | Success via Unix socket | ⏳ TODO |
| Wrong password | Connect with bad password | Error: authentication failed | ⏳ TODO |
| No .pgpass file | Remote connection | Prompt for password | ⏳ TODO |
#### 5.2 Disk Space
| Test Case | Scenario | Expected Result | Status |
|-----------|----------|-----------------|--------|
| Insufficient space | Backup when disk full | Error before starting | ⏳ TODO |
| Restore needs space | Restore 10GB with 5GB free | Error with clear message | ⏳ TODO |
#### 5.3 Database State
| Test Case | Scenario | Expected Result | Status |
|-----------|----------|-----------------|--------|
| Active connections | Restore DB with connections | Terminate connections first | ⏳ TODO |
| Database locked | Backup locked DB | Wait or error gracefully | ⏳ TODO |
| Corrupted database | Backup corrupted DB | Warning but continue | ⏳ TODO |
#### 5.4 Network & Remote
| Test Case | Scenario | Expected Result | Status |
|-----------|----------|-----------------|--------|
| Remote host | `--host=remote.server` | Connect via TCP | ⏳ TODO |
| Network timeout | Connection hangs | Timeout with error | ⏳ TODO |
| SSL required | `--ssl-mode=require` | Connect with SSL | ⏳ TODO |
---
### 6. CROSS-PLATFORM COMPATIBILITY
| Platform | Test | Status |
|----------|------|--------|
| Linux amd64 | All operations | ⏳ TODO |
| Linux arm64 | All operations | ⏳ TODO |
| macOS Intel | All operations | ⏳ TODO |
| macOS ARM | All operations | ⏳ TODO |
| Windows amd64 | All operations | ⏳ TODO |
---
## Testing Procedure
### Phase 1: Command-Line Testing (Current)
1. ✅ Test basic backup single
2. ✅ Test basic backup cluster
3. ✅ Test restore list
4.**Found BUG #1**: restore single --create not working
5. ⏳ Test remaining command-line operations
### Phase 2: Fix Critical Bugs
1. Fix BUG #1: Implement database creation in RestoreSingle
2. Test fix thoroughly
3. Commit and push
### Phase 3: Interactive Mode Testing
1. Test all TUI menu options
2. Test navigation and user input
3. Test progress indicators
4. Test error handling
### Phase 4: Edge Case Testing
1. Test authentication scenarios
2. Test disk space limits
3. Test error conditions
4. Test concurrent operations
### Phase 5: Documentation & Report
1. Update README with known issues
2. Create bug fix changelog
3. Update user documentation
4. Final stability report
---
## Success Criteria
- ✅ All critical bugs fixed
- ✅ All command-line operations work as documented
- ✅ All interactive operations complete successfully
- ✅ Error messages are clear and helpful
- ✅ No crashes or panics under normal use
- ✅ Cross-platform builds succeed
- ✅ Documentation matches actual behavior
---
## Notes
- Test with PostgreSQL peer authentication (most common setup)
- Test with MariaDB/MySQL (ensure no regressions)
- Test with both superuser and regular user accounts
- Test with various database sizes (small, medium, large)
- Test with special characters in database names
---
**Last Updated**: November 10, 2025
**Test Progress**: 3/100+ tests completed
**Critical Bugs Found**: 1
**Status**: IN PROGRESS

View File

@@ -1,160 +0,0 @@
# Test Suite Results Summary
**Date**: November 10, 2025
**Test Suite**: test_suite.sh
**Results File**: test_results_20251110_090957.txt
## Summary Statistics
- **Total Tests**: 54
- **Passed**: 48 (88.9%)
- **Failed**: 6 (11.1%)
- **Skipped**: 0
## Failed Tests Analysis
### 1. ❌ Backup single with custom backup dir
**Command**: `backup single test_automation_db --backup-dir=/tmp/test_backups_XXXXX`
**Exit Code**: 1
**Error**: `backup command failed: exit status 1`
**Issue**: Likely permission issue with custom directory or pg_dump output directory
**Severity**: MEDIUM
**Action Required**: Investigate backup directory creation and permissions
---
### 2. ❌ Backup cluster with custom backup dir
**Command**: `backup cluster --backup-dir=/tmp/test_backups_XXXXX`
**Exit Code**: 1
**Error**: Similar to #1
**Issue**: Same as #1 - custom backup directory handling
**Severity**: MEDIUM
**Action Required**: Same fix as #1
---
### 3. ❌ Restore single with --verbose
**Command**: `restore single backup.dump --target=test_db --verbose --confirm`
**Exit Code**: 1
**Error**: Restore command failed
**Issue**: --verbose flag may not be properly passed or database already exists
**Severity**: LOW
**Action Required**: Investigate --verbose flag handling in restore
---
### 4. ❌ Restore single with --force
**Command**: `restore single backup.dump --target=test_db --force --confirm`
**Exit Code**: 1
**Error**: Restore command failed
**Issue**: --force flag may not skip safety checks as expected, or database state issue
**Severity**: MEDIUM
**Action Required**: Verify --force flag bypasses validation correctly
---
### 5. ❌ SSL mode require (should have failed)
**Command**: `status --ssl-mode=require`
**Exit Code**: 0 (expected: non-zero)
**Error**: Test expected this to fail (SSL not configured), but it succeeded
**Issue**: SSL mode validation not enforced, or test assumption incorrect
**Severity**: LOW
**Action Required**: Verify if SSL mode should fail without SSL configured
---
### 6. ❌ Invalid CPU workload (should fail)
**Command**: `status --cpu-workload=invalid`
**Exit Code**: 0 (expected: non-zero)
**Error**: Invalid value accepted
**Issue**: Input validation missing for CPU workload parameter
**Severity**: LOW
**Action Required**: Add validation for cpu-workload flag values
---
## Passed Tests Highlights
✅ All basic commands (help, version, status)
✅ Backup single database with various compression levels
✅ Backup cluster operations
✅ Restore list functionality
✅ Restore single database (basic, --clean, --create, --dry-run)
✅ Restore cluster operations (all variants)
✅ Global flags (host, port, user, db-type, jobs, cores)
✅ Authentication tests (peer auth, user flags)
✅ Error scenarios (non-existent database, invalid compression, invalid port)
✅ Interactive mode help
## Test Coverage Analysis
### Well-Tested Areas ✅
- Basic backup operations (single & cluster)
- Restore operations (single & cluster)
- Compression levels
- Job parallelization
- Authentication handling
- Global configuration flags
- Error handling for invalid inputs
### Areas Needing Attention ⚠️
1. Custom backup directory handling
2. --verbose flag in restore operations
3. --force flag behavior in restore
4. SSL mode validation
5. CPU workload input validation
### Not Fully Tested 🔍
- MariaDB/MySQL operations (only PostgreSQL tested)
- Remote database connections (only localhost)
- Network failure scenarios
- Large database operations (>1GB)
- Concurrent operations
- Full interactive TUI testing
## Recommendations
### High Priority
1. Fix custom backup directory issues (#1, #2)
2. Fix --force flag in restore (#4)
### Medium Priority
3. Investigate --verbose flag behavior (#3)
4. Add input validation for cpu-workload flag (#6)
### Low Priority
5. Review SSL mode requirements (#5)
### Future Enhancements
- Add MySQL/MariaDB test cases
- Add remote connection tests
- Add performance benchmarks
- Add stress tests (large databases)
- Add concurrent operation tests
- Full interactive TUI automation
## Conclusion
**Overall Status**: ✅ STABLE (88.9% pass rate)
The application is **highly stable** with only minor issues found:
- Core functionality works correctly
- All critical operations tested successfully
- Failed tests are edge cases or validation issues
- No crashes or data corruption observed
The identified issues are non-critical and can be addressed in future updates.
---
**Test Environment**:
- OS: Linux
- PostgreSQL: Running with peer authentication
- User: postgres (via sudo)
- Platform: Linux amd64
**Next Steps**:
1. Review and fix the 6 identified issues
2. Re-run test suite to verify fixes
3. Proceed with interactive mode testing
4. Create regression test suite

View File

@@ -1,2331 +0,0 @@
================================================================
DBBackup Complete Test Suite
================================================================
Date: Mon Nov 10 09:09:57 AM UTC 2025
Host: psqldb
User: root
DBBackup: ./dbbackup
Results File: test_results_20251110_090957.txt
[09:09:57] Setting up test environment...
[09:09:57] Test environment ready
================================================================
1. Basic Commands
================================================================
[09:09:57] Running: Help command
Command: sudo -u postgres ./dbbackup --help
Exit Code: 0
Output:
A comprehensive database backup and restore solution supporting both PostgreSQL and MySQL.
Features:
- CPU-aware parallel processing
- Multiple backup modes (cluster, single database, sample)
- Interactive UI and CLI modes
- Archive verification and restore
- Progress indicators and timing summaries
- Robust error handling and logging
Database Support:
- PostgreSQL (via pg_dump/pg_restore)
- MySQL (via mysqldump/mysql)
For help with specific commands, use: dbbackup [command] --help
Usage:
dbbackup [command]
Available Commands:
backup Create database backups
completion Generate the autocompletion script for the specified shell
cpu Show CPU information and optimization settings
help Help about any command
interactive Start interactive menu mode
list List available backups and databases
preflight Run preflight checks
restore Restore databases from backup archives
restore Restore databases from backup archives
status Show connection status and configuration
verify Verify backup archive integrity
Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/var/lib/pgsql/db_backups")
--compression int Compression level (0-9) (default 6)
--cpu-workload string CPU workload type (cpu-intensive|io-intensive|balanced) (default "balanced")
--database string Database name (default "postgres")
-d, --db-type string Database type (postgres|mysql|mariadb) (default "postgres")
--debug Enable debug logging
--dump-jobs int Number of parallel dump jobs (default 8)
-h, --help help for dbbackup
--host string Database host (default "localhost")
--insecure Disable SSL (shortcut for --ssl-mode=disable)
--jobs int Number of parallel jobs (default 8)
--max-cores int Maximum CPU cores to use (default 16)
--no-color Disable colored output
--password string Database password
--port int Database port (default 5432)
--ssl-mode string SSL mode for connections (default "prefer")
---
✅ PASS: Help command
[09:09:57] Running: Version flag
Command: sudo -u postgres ./dbbackup --version
Exit Code: 0
Output:
dbbackup version dev (built: unknown, commit: unknown)
---
✅ PASS: Version flag
[09:09:57] Running: Status command
Command: sudo -u postgres ./dbbackup status
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
⠋ Checking required tools...
✅ Required tools available
INFO  [2025-11-10T09:09:57] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 16 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (13 more)
✅ Status check completed successfully!
---
✅ PASS: Status command
================================================================
2. Backup Single Database
================================================================
[09:09:57] Running: Backup single database (basic)
Command: sudo -u postgres ./dbbackup backup single test_automation_db
Exit Code: 0
Output:
INFO  [2025-11-10T09:09:57] Starting single database backup database=test_automation_db
INFO  [2025-11-10T09:09:57] Connected to PostgreSQL successfully max_conns=10 driver=pgx
🔄 Starting backup: test_automation_db
INFO  [2025-11-10T09:09:57] Operation started
INFO  [2025-11-10T09:09:57] Step started
INFO  [2025-11-10T09:09:57] Step completed (29.487µs)
[10%] Backup directory prepared
[20%] Generated backup filename
INFO  [2025-11-10T09:09:57] Step started
INFO  [2025-11-10T09:09:57] Step completed (21.662µs)
[30%] Backup command prepared
INFO  [2025-11-10T09:09:57] Step started
[40%] Starting database backup...
INFO  [2025-11-10T09:09:57] Step completed (87.011298ms)
[80%] Database backup completed
INFO  [2025-11-10T09:09:57] Step started
INFO  [2025-11-10T09:09:57] Step completed (45.019µs)
[90%] Backup verified: 2.4 KB
INFO  [2025-11-10T09:09:57] Step started
INFO  [2025-11-10T09:09:57] Step completed (450.46µs)
[100%] Backup operation completed successfully
✅ ✅ Single database backup completed: db_test_automation_db_20251110_090957.dump
INFO  [2025-11-10T09:09:57] Operation completed (87.892633ms)
---
✅ PASS: Backup single database (basic)
[09:09:57] Running: Backup single with compression level 9
Command: sudo -u postgres ./dbbackup backup single test_automation_db --compression=9
Exit Code: 0
Output:
INFO  [2025-11-10T09:09:57] Starting single database backup database=test_automation_db
INFO  [2025-11-10T09:09:57] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting backup: test_automation_db
INFO  [2025-11-10T09:09:57] Operation started
INFO  [2025-11-10T09:09:57] Step started
INFO  [2025-11-10T09:09:57] Step completed (26.581µs)
[10%] Backup directory prepared
[20%] Generated backup filename
INFO  [2025-11-10T09:09:57] Step started
INFO  [2025-11-10T09:09:57] Step completed (10.12µs)
[30%] Backup command prepared
INFO  [2025-11-10T09:09:57] Step started
[40%] Starting database backup...
INFO  [2025-11-10T09:09:57] Step completed (94.738684ms)
[80%] Database backup completed
INFO  [2025-11-10T09:09:57] Step started
INFO  [2025-11-10T09:09:57] Step completed (27.583µs)
[90%] Backup verified: 2.4 KB
INFO  [2025-11-10T09:09:57] Step started
INFO  [2025-11-10T09:09:57] Step completed (185.086µs)
[100%] Backup operation completed successfully
✅ ✅ Single database backup completed: db_test_automation_db_20251110_090957.dump
INFO  [2025-11-10T09:09:57] Operation completed (95.17162ms)
---
✅ PASS: Backup single with compression level 9
[09:09:57] Running: Backup single with compression level 1
Command: sudo -u postgres ./dbbackup backup single test_automation_db --compression=1
Exit Code: 0
Output:
INFO  [2025-11-10T09:09:57] Starting single database backup database=test_automation_db
INFO  [2025-11-10T09:09:57] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting backup: test_automation_db
INFO  [2025-11-10T09:09:57] Operation started
INFO  [2025-11-10T09:09:57] Step started
INFO  [2025-11-10T09:09:57] Step completed (43.06µs)
[10%] Backup directory prepared
[20%] Generated backup filename
INFO  [2025-11-10T09:09:57] Step started
INFO  [2025-11-10T09:09:57] Step completed (22.425µs)
[30%] Backup command prepared
INFO  [2025-11-10T09:09:57] Step started
[40%] Starting database backup...
INFO  [2025-11-10T09:09:58] Step completed (97.709995ms)
[80%] Database backup completed
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (39.803µs)
[90%] Backup verified: 2.4 KB
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (198.257µs)
[100%] Backup operation completed successfully
✅ ✅ Single database backup completed: db_test_automation_db_20251110_090957.dump
INFO  [2025-11-10T09:09:58] Operation completed (98.283211ms)
---
✅ PASS: Backup single with compression level 1
[09:09:58] Running: Backup single with custom backup dir
Command: sudo -u postgres ./dbbackup backup single test_automation_db --backup-dir=/tmp/test_backups_1046326
Exit Code: 1
Output:
INFO  [2025-11-10T09:09:58] Starting single database backup database=test_automation_db
INFO  [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting backup: test_automation_db
INFO  [2025-11-10T09:09:58] Operation started
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (29.638µs)
[10%] Backup directory prepared
[20%] Generated backup filename
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (20.642µs)
[30%] Backup command prepared
INFO  [2025-11-10T09:09:58] Step started
[40%] Starting database backup...
ERROR [2025-11-10T09:09:58] Step failed (6.848703ms) error=backup execution failed: backup command failed: exit status 1
❌ ❌ backup failed: backup command failed: exit status 1
ERROR [2025-11-10T09:09:58] Operation failed error=backup failed: backup command failed: exit status 1 (7.081045ms)
Error: backup failed: backup command failed: exit status 1
Usage:
dbbackup backup single [database] [flags]
Flags:
-h, --help help for single
Global Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/var/lib/pgsql/db_backups")
--compression int Compression level (0-9) (default 6)
--cpu-workload string CPU workload type (cpu-intensive|io-intensive|balanced) (default "balanced")
--database string Database name (default "postgres")
-d, --db-type string Database type (postgres|mysql|mariadb) (default "postgres")
--debug Enable debug logging
--dump-jobs int Number of parallel dump jobs (default 8)
--host string Database host (default "localhost")
--insecure Disable SSL (shortcut for --ssl-mode=disable)
--jobs int Number of parallel jobs (default 8)
--max-cores int Maximum CPU cores to use (default 16)
--no-color Disable colored output
--password string Database password
--port int Database port (default 5432)
--ssl-mode string SSL mode for connections (default "prefer")
--user string Database user (default "postgres")
ERROR [2025-11-10T09:09:58] Application failed error=backup failed: backup command failed: exit status 1
---
❌ FAIL: Backup single with custom backup dir (exit code: 1)
[09:09:58] Running: Backup single with jobs=1
Command: sudo -u postgres ./dbbackup backup single test_automation_db --jobs=1
Exit Code: 0
Output:
INFO  [2025-11-10T09:09:58] Starting single database backup database=test_automation_db
INFO  [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting backup: test_automation_db
INFO  [2025-11-10T09:09:58] Operation started
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (24.798µs)
[10%] Backup directory prepared
[20%] Generated backup filename
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (9.769µs)
[30%] Backup command prepared
INFO  [2025-11-10T09:09:58] Step started
[40%] Starting database backup...
INFO  [2025-11-10T09:09:58] Step completed (93.903526ms)
[80%] Database backup completed
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (35.784µs)
[90%] Backup verified: 2.4 KB
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (174.422µs)
[100%] Backup operation completed successfully
✅ ✅ Single database backup completed: db_test_automation_db_20251110_090958.dump
INFO  [2025-11-10T09:09:58] Operation completed (94.353115ms)
---
✅ PASS: Backup single with jobs=1
[09:09:58] Running: Backup single with jobs=16
Command: sudo -u postgres ./dbbackup backup single test_automation_db --jobs=16
Exit Code: 0
Output:
INFO  [2025-11-10T09:09:58] Starting single database backup database=test_automation_db
INFO  [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting backup: test_automation_db
INFO  [2025-11-10T09:09:58] Operation started
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (26.215µs)
[10%] Backup directory prepared
[20%] Generated backup filename
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (13.906µs)
[30%] Backup command prepared
INFO  [2025-11-10T09:09:58] Step started
[40%] Starting database backup...
INFO  [2025-11-10T09:09:58] Step completed (97.612874ms)
[80%] Database backup completed
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (34.496µs)
[90%] Backup verified: 2.4 KB
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (177.431µs)
[100%] Backup operation completed successfully
✅ ✅ Single database backup completed: db_test_automation_db_20251110_090958.dump
INFO  [2025-11-10T09:09:58] Operation completed (98.064382ms)
---
✅ PASS: Backup single with jobs=16
[09:09:58] Running: Backup single non-existent database (should fail)
Command: sudo -u postgres ./dbbackup backup single nonexistent_database_xyz
Exit Code: 1
Output:
INFO  [2025-11-10T09:09:58] Starting single database backup database=nonexistent_database_xyz
INFO  [2025-11-10T09:09:58] Connected to PostgreSQL successfully max_conns=10 driver=pgx
Error: database 'nonexistent_database_xyz' does not exist
Usage:
dbbackup backup single [database] [flags]
Flags:
-h, --help help for single
Global Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/var/lib/pgsql/db_backups")
--compression int Compression level (0-9) (default 6)
--cpu-workload string CPU workload type (cpu-intensive|io-intensive|balanced) (default "balanced")
--database string Database name (default "postgres")
-d, --db-type string Database type (postgres|mysql|mariadb) (default "postgres")
--debug Enable debug logging
--dump-jobs int Number of parallel dump jobs (default 8)
--host string Database host (default "localhost")
--insecure Disable SSL (shortcut for --ssl-mode=disable)
--jobs int Number of parallel jobs (default 8)
--max-cores int Maximum CPU cores to use (default 16)
--no-color Disable colored output
--password string Database password
--port int Database port (default 5432)
--ssl-mode string SSL mode for connections (default "prefer")
--user string Database user (default "postgres")
ERROR [2025-11-10T09:09:58] Application failed error=database 'nonexistent_database_xyz' does not exist
---
✅ PASS: Backup single non-existent database (should fail) (correctly failed)
[09:09:58] Running: Backup single with debug logging
Command: sudo -u postgres ./dbbackup backup single test_automation_db --debug
Exit Code: 0
Output:
INFO  [2025-11-10T09:09:58] Starting single database backup database=test_automation_db
INFO  [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting backup: test_automation_db
INFO  [2025-11-10T09:09:58] Operation started
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (31.619µs)
[10%] Backup directory prepared
[20%] Generated backup filename
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (12.937µs)
[30%] Backup command prepared
INFO  [2025-11-10T09:09:58] Step started
[40%] Starting database backup...
INFO  [2025-11-10T09:09:58] Step completed (94.583288ms)
[80%] Database backup completed
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (43.511µs)
[90%] Backup verified: 2.4 KB
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (177.804µs)
[100%] Backup operation completed successfully
✅ ✅ Single database backup completed: db_test_automation_db_20251110_090958.dump
INFO  [2025-11-10T09:09:58] Operation completed (95.097145ms)
---
✅ PASS: Backup single with debug logging
[09:09:58] Running: Backup single with no-color
Command: sudo -u postgres ./dbbackup backup single test_automation_db --no-color
Exit Code: 0
Output:
INFO  [2025-11-10T09:09:58] Starting single database backup database=test_automation_db
INFO  [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting backup: test_automation_db
INFO  [2025-11-10T09:09:58] Operation started
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (30.472µs)
[10%] Backup directory prepared
[20%] Generated backup filename
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (23.534µs)
[30%] Backup command prepared
INFO  [2025-11-10T09:09:58] Step started
[40%] Starting database backup...
INFO  [2025-11-10T09:09:58] Step completed (104.354812ms)
[80%] Database backup completed
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (44.888µs)
[90%] Backup verified: 2.4 KB
INFO  [2025-11-10T09:09:58] Step started
INFO  [2025-11-10T09:09:58] Step completed (270.241µs)
[100%] Backup operation completed successfully
✅ ✅ Single database backup completed: db_test_automation_db_20251110_090958.dump
INFO  [2025-11-10T09:09:58] Operation completed (104.973414ms)
---
✅ PASS: Backup single with no-color
================================================================
3. Backup Cluster
================================================================
[09:09:58] Running: Backup cluster (basic)
Command: sudo -u postgres ./dbbackup backup cluster
Exit Code: 0
Output:
INFO  [2025-11-10T09:09:58] Starting cluster backup
INFO  [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting cluster backup (all databases)
INFO  [2025-11-10T09:09:58] [Cluster Backup] Starting cluster backup
Backing up global objects...
Getting database list...
Backing up 16 databases...
[1/16] Backing up database: backup_test_db
Database size: 83.6 MB
✅ Completed backup_test_db (56.5 MB)
[2/16] Backing up database: cli_test_db
Database size: 7.6 MB
✅ Completed cli_test_db (8.1 KB)
[3/16] Backing up database: cluster_restore_test
Database size: 7.4 MB
✅ Completed cluster_restore_test (870 B)
[4/16] Backing up database: final_test_db
Database size: 7.5 MB
✅ Completed final_test_db (2.8 KB)
[5/16] Backing up database: large_test_db
Database size: 42.2 MB
✅ Completed large_test_db (806.9 KB)
[6/16] Backing up database: menu_test_db
Database size: 7.5 MB
✅ Completed menu_test_db (3.0 KB)
[7/16] Backing up database: ownership_test
Database size: 7.5 MB
✅ Completed ownership_test (2.6 KB)
[8/16] Backing up database: perfect_test_db
Database size: 7.5 MB
✅ Completed perfect_test_db (3.0 KB)
[9/16] Backing up database: postgres
Database size: 7.4 MB
✅ Completed postgres (822 B)
[10/16] Backing up database: restored_ownership_test
Database size: 7.5 MB
✅ Completed restored_ownership_test (2.7 KB)
[11/16] Backing up database: test_automation_db
Database size: 7.5 MB
✅ Completed test_automation_db (2.4 KB)
[12/16] Backing up database: test_restore_timing
Database size: 7.5 MB
✅ Completed test_restore_timing (3.9 KB)
[13/16] Backing up database: test_sample_backup
Database size: 7.5 MB
✅ Completed test_sample_backup (4.9 KB)
[14/16] Backing up database: test_single_backup
Database size: 7.5 MB
✅ Completed test_single_backup (3.9 KB)
---
✅ PASS: Backup cluster (basic)
[09:10:04] Running: Backup cluster with compression 9
Command: sudo -u postgres ./dbbackup backup cluster --compression=9
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:05] Starting cluster backup
INFO  [2025-11-10T09:10:05] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting cluster backup (all databases)
INFO  [2025-11-10T09:10:05] [Cluster Backup] Starting cluster backup
Backing up global objects...
Getting database list...
Backing up 16 databases...
[1/16] Backing up database: backup_test_db
Database size: 83.6 MB
✅ Completed backup_test_db (56.5 MB)
[2/16] Backing up database: cli_test_db
Database size: 7.6 MB
✅ Completed cli_test_db (8.1 KB)
[3/16] Backing up database: cluster_restore_test
Database size: 7.4 MB
✅ Completed cluster_restore_test (870 B)
[4/16] Backing up database: final_test_db
Database size: 7.5 MB
✅ Completed final_test_db (2.8 KB)
[5/16] Backing up database: large_test_db
Database size: 42.2 MB
✅ Completed large_test_db (806.9 KB)
[6/16] Backing up database: menu_test_db
Database size: 7.5 MB
✅ Completed menu_test_db (3.0 KB)
[7/16] Backing up database: ownership_test
Database size: 7.5 MB
✅ Completed ownership_test (2.6 KB)
[8/16] Backing up database: perfect_test_db
Database size: 7.5 MB
✅ Completed perfect_test_db (3.0 KB)
[9/16] Backing up database: postgres
Database size: 7.4 MB
✅ Completed postgres (822 B)
[10/16] Backing up database: restored_ownership_test
Database size: 7.5 MB
✅ Completed restored_ownership_test (2.7 KB)
[11/16] Backing up database: test_automation_db
Database size: 7.5 MB
✅ Completed test_automation_db (2.4 KB)
[12/16] Backing up database: test_restore_timing
Database size: 7.5 MB
✅ Completed test_restore_timing (3.9 KB)
[13/16] Backing up database: test_sample_backup
Database size: 7.5 MB
✅ Completed test_sample_backup (4.9 KB)
[14/16] Backing up database: test_single_backup
Database size: 7.5 MB
✅ Completed test_single_backup (3.9 KB)
---
✅ PASS: Backup cluster with compression 9
[09:10:10] Running: Backup cluster with jobs=4
Command: sudo -u postgres ./dbbackup backup cluster --jobs=4
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:10] Starting cluster backup
INFO  [2025-11-10T09:10:10] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting cluster backup (all databases)
INFO  [2025-11-10T09:10:10] [Cluster Backup] Starting cluster backup
Backing up global objects...
Getting database list...
Backing up 16 databases...
[1/16] Backing up database: backup_test_db
Database size: 83.6 MB
✅ Completed backup_test_db (56.5 MB)
[2/16] Backing up database: cli_test_db
Database size: 7.6 MB
✅ Completed cli_test_db (8.1 KB)
[3/16] Backing up database: cluster_restore_test
Database size: 7.4 MB
✅ Completed cluster_restore_test (870 B)
[4/16] Backing up database: final_test_db
Database size: 7.5 MB
✅ Completed final_test_db (2.8 KB)
[5/16] Backing up database: large_test_db
Database size: 42.2 MB
✅ Completed large_test_db (806.9 KB)
[6/16] Backing up database: menu_test_db
Database size: 7.5 MB
✅ Completed menu_test_db (3.0 KB)
[7/16] Backing up database: ownership_test
Database size: 7.5 MB
✅ Completed ownership_test (2.6 KB)
[8/16] Backing up database: perfect_test_db
Database size: 7.5 MB
✅ Completed perfect_test_db (3.0 KB)
[9/16] Backing up database: postgres
Database size: 7.4 MB
✅ Completed postgres (822 B)
[10/16] Backing up database: restored_ownership_test
Database size: 7.5 MB
✅ Completed restored_ownership_test (2.7 KB)
[11/16] Backing up database: test_automation_db
Database size: 7.5 MB
✅ Completed test_automation_db (2.4 KB)
[12/16] Backing up database: test_restore_timing
Database size: 7.5 MB
✅ Completed test_restore_timing (3.9 KB)
[13/16] Backing up database: test_sample_backup
Database size: 7.5 MB
✅ Completed test_sample_backup (4.9 KB)
[14/16] Backing up database: test_single_backup
Database size: 7.5 MB
✅ Completed test_single_backup (3.9 KB)
---
✅ PASS: Backup cluster with jobs=4
[09:10:16] Running: Backup cluster with dump-jobs=4
Command: sudo -u postgres ./dbbackup backup cluster --dump-jobs=4
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:16] Starting cluster backup
INFO  [2025-11-10T09:10:16] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting cluster backup (all databases)
INFO  [2025-11-10T09:10:16] [Cluster Backup] Starting cluster backup
Backing up global objects...
Getting database list...
Backing up 16 databases...
[1/16] Backing up database: backup_test_db
Database size: 83.6 MB
✅ Completed backup_test_db (56.5 MB)
[2/16] Backing up database: cli_test_db
Database size: 7.6 MB
✅ Completed cli_test_db (8.1 KB)
[3/16] Backing up database: cluster_restore_test
Database size: 7.4 MB
✅ Completed cluster_restore_test (870 B)
[4/16] Backing up database: final_test_db
Database size: 7.5 MB
✅ Completed final_test_db (2.8 KB)
[5/16] Backing up database: large_test_db
Database size: 42.2 MB
✅ Completed large_test_db (806.9 KB)
[6/16] Backing up database: menu_test_db
Database size: 7.5 MB
✅ Completed menu_test_db (3.0 KB)
[7/16] Backing up database: ownership_test
Database size: 7.5 MB
✅ Completed ownership_test (2.6 KB)
[8/16] Backing up database: perfect_test_db
Database size: 7.5 MB
✅ Completed perfect_test_db (3.0 KB)
[9/16] Backing up database: postgres
Database size: 7.4 MB
✅ Completed postgres (822 B)
[10/16] Backing up database: restored_ownership_test
Database size: 7.5 MB
✅ Completed restored_ownership_test (2.7 KB)
[11/16] Backing up database: test_automation_db
Database size: 7.5 MB
✅ Completed test_automation_db (2.4 KB)
[12/16] Backing up database: test_restore_timing
Database size: 7.5 MB
✅ Completed test_restore_timing (3.9 KB)
[13/16] Backing up database: test_sample_backup
Database size: 7.5 MB
✅ Completed test_sample_backup (4.9 KB)
[14/16] Backing up database: test_single_backup
Database size: 7.5 MB
✅ Completed test_single_backup (3.9 KB)
---
✅ PASS: Backup cluster with dump-jobs=4
[09:10:22] Running: Backup cluster with custom backup dir
Command: sudo -u postgres ./dbbackup backup cluster --backup-dir=/tmp/test_backups_1046326
Exit Code: 1
Output:
INFO  [2025-11-10T09:10:22] Starting cluster backup
INFO  [2025-11-10T09:10:22] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting cluster backup (all databases)
INFO  [2025-11-10T09:10:22] [Cluster Backup] Starting cluster backup
ERROR [2025-11-10T09:10:22] [Cluster Backup] FAILED: Failed to create temporary directory (0.0s)
❌ Failed to create temporary directory
Error: failed to create temp directory: mkdir /tmp/test_backups_1046326/.cluster_20251110_091022: permission denied
Usage:
dbbackup backup cluster [flags]
Flags:
-h, --help help for cluster
Global Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/var/lib/pgsql/db_backups")
--compression int Compression level (0-9) (default 6)
--cpu-workload string CPU workload type (cpu-intensive|io-intensive|balanced) (default "balanced")
--database string Database name (default "postgres")
-d, --db-type string Database type (postgres|mysql|mariadb) (default "postgres")
--debug Enable debug logging
--dump-jobs int Number of parallel dump jobs (default 8)
--host string Database host (default "localhost")
--insecure Disable SSL (shortcut for --ssl-mode=disable)
--jobs int Number of parallel jobs (default 8)
--max-cores int Maximum CPU cores to use (default 16)
--no-color Disable colored output
--password string Database password
--port int Database port (default 5432)
--ssl-mode string SSL mode for connections (default "prefer")
--user string Database user (default "postgres")
ERROR [2025-11-10T09:10:22] Application failed error=failed to create temp directory: mkdir /tmp/test_backups_1046326/.cluster_20251110_091022: permission denied
---
❌ FAIL: Backup cluster with custom backup dir (exit code: 1)
[09:10:22] Running: Backup cluster with debug
Command: sudo -u postgres ./dbbackup backup cluster --debug
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:22] Starting cluster backup
INFO  [2025-11-10T09:10:22] Connected to PostgreSQL successfully driver=pgx max_conns=10
🔄 Starting cluster backup (all databases)
INFO  [2025-11-10T09:10:22] [Cluster Backup] Starting cluster backup
Backing up global objects...
Getting database list...
Backing up 16 databases...
[1/16] Backing up database: backup_test_db
Database size: 83.6 MB
✅ Completed backup_test_db (56.5 MB)
[2/16] Backing up database: cli_test_db
Database size: 7.6 MB
✅ Completed cli_test_db (8.1 KB)
[3/16] Backing up database: cluster_restore_test
Database size: 7.4 MB
✅ Completed cluster_restore_test (870 B)
[4/16] Backing up database: final_test_db
Database size: 7.5 MB
✅ Completed final_test_db (2.8 KB)
[5/16] Backing up database: large_test_db
Database size: 42.2 MB
✅ Completed large_test_db (806.9 KB)
[6/16] Backing up database: menu_test_db
Database size: 7.5 MB
✅ Completed menu_test_db (3.0 KB)
[7/16] Backing up database: ownership_test
Database size: 7.5 MB
✅ Completed ownership_test (2.6 KB)
[8/16] Backing up database: perfect_test_db
Database size: 7.5 MB
✅ Completed perfect_test_db (3.0 KB)
[9/16] Backing up database: postgres
Database size: 7.4 MB
✅ Completed postgres (822 B)
[10/16] Backing up database: restored_ownership_test
Database size: 7.5 MB
✅ Completed restored_ownership_test (2.7 KB)
[11/16] Backing up database: test_automation_db
Database size: 7.5 MB
✅ Completed test_automation_db (2.4 KB)
[12/16] Backing up database: test_restore_timing
Database size: 7.5 MB
✅ Completed test_restore_timing (3.9 KB)
[13/16] Backing up database: test_sample_backup
Database size: 7.5 MB
✅ Completed test_sample_backup (4.9 KB)
[14/16] Backing up database: test_single_backup
Database size: 7.5 MB
✅ Completed test_single_backup (3.9 KB)
---
✅ PASS: Backup cluster with debug
================================================================
4. Restore List
================================================================
[09:10:27] Running: List available backups
Command: sudo -u postgres ./dbbackup restore list
Exit Code: 0
Output:
📦 Available backup archives in /var/lib/pgsql/db_backups
FILENAME FORMAT SIZE MODIFIED DATABASE
------------------------------------------------------------------------------------------------------------------------
cluster_20251022_170857.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 17:09:05 cluster
cluster_20251022_172513.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 17:25:21 cluster
cluster_20251022_181047.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:10:55 cluster
cluster_20251022_181202.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:12:11 cluster
cluster_20251022_182103.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:21:11 cluster
cluster_20251022_182400.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:24:09 cluster
cluster_20251022_182421.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:24:29 cluster
cluster_20251022_182433.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:24:41 cluster
cluster_20251022_183430.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:34:39 cluster
cluster_20251022_183955.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:40:05 cluster
cluster_20251022_184009.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:40:18 cluster
cluster_20251022_184035.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:40:44 cluster
cluster_20251022_184049.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:40:58 cluster
cluster_20251022_184313.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:43:21 cluster
cluster_20251022_184533.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:45:41 cluster
cluster_20251022_184859.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:49:08 cluster
cluster_20251022_185144.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:51:53 cluster
cluster_20251022_185423.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:54:32 cluster
cluster_20251022_185845.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:58:54 cluster
cluster_20251022_185926.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 18:59:35 cluster
cluster_20251022_190430.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 19:04:38 cluster
cluster_20251022_190938.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 19:09:46 cluster
cluster_20251022_191703.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 19:17:13 cluster
cluster_20251022_192558.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 19:26:07 cluster
cluster_20251022_192906.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-22 19:29:15 cluster
cluster_20251023_091803.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-23 09:18:13 cluster
cluster_20251023_142814.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-23 14:28:22 cluster
cluster_20251023_151441.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-23 15:14:48 cluster
cluster_20251024_090319.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-10-24 09:03:26 cluster
cluster_20251105_121823.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-05 12:18:29 cluster
cluster_20251105_121855.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-05 12:19:00 cluster
cluster_20251105_132523.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-05 13:25:29 cluster
cluster_20251105_132616.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-05 13:26:22 cluster
cluster_20251105_133105.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-05 13:31:11 cluster
cluster_20251105_133459.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-05 13:35:06 cluster
cluster_20251105_133924.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-05 13:39:29 cluster
cluster_20251105_134829.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-05 13:48:34 cluster
cluster_20251105_135646.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-05 13:56:52 cluster
cluster_20251105_140256.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-05 14:03:02 cluster
cluster_20251106_081543.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-06 08:15:48 cluster
cluster_20251107_101639.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-07 10:16:44 cluster
cluster_20251107_112726.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-07 11:27:32 cluster
cluster_20251107_114858.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-07 11:49:03 cluster
cluster_20251107_124952.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-07 12:49:57 cluster
cluster_20251107_130416.tar.gz Cluster Archive (tar.gz) 56.6 MB 2025-11-07 13:04:22 cluster
---
✅ PASS: List available backups
[09:10:27] Running: List backups from custom dir
Command: sudo -u postgres ./dbbackup restore list --backup-dir=/tmp/test_backups_1046326
Exit Code: 0
Output:
No backup archives found in: /tmp/test_backups_1046326
---
✅ PASS: List backups from custom dir
================================================================
5. Restore Single Database
================================================================
[09:10:27] Using backup file: /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump
[09:10:27] Running: Restore single database (basic)
Command: sudo -u postgres ./dbbackup restore single /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump --target=test_automation_db_restored --confirm
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:27] Archive information
INFO  [2025-11-10T09:10:27] Validating archive...
INFO  [2025-11-10T09:10:27] Checking disk space...
INFO  [2025-11-10T09:10:27] Disk space check passed
INFO  [2025-11-10T09:10:27] Starting restore... database=test_automation_db_restored
INFO  [2025-11-10T09:10:27] Detected archive format
🔄 Restoring database 'test_automation_db_restored' from db_test_automation_db_20251110_090958.dump
INFO  [2025-11-10T09:10:27] Executing restore command
INFO  [2025-11-10T09:10:27] Restore command completed successfully
✅ Database 'test_automation_db_restored' restored successfully
INFO  [2025-11-10T09:10:27] [Single Database Restore] COMPLETED: Restored database 'test_automation_db_restored' from db_test_automation_db_20251110_090958.dump (0.0s)
INFO  [2025-11-10T09:10:27] ✅ Restore completed successfully database=test_automation_db_restored
---
✅ PASS: Restore single database (basic)
[09:10:28] Running: Restore single with --clean flag
Command: sudo -u postgres ./dbbackup restore single /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump --target=test_automation_db_restored --clean --confirm
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:28] Archive information
INFO  [2025-11-10T09:10:28] Validating archive...
INFO  [2025-11-10T09:10:28] Checking disk space...
INFO  [2025-11-10T09:10:28] Disk space check passed
INFO  [2025-11-10T09:10:28] Starting restore... database=test_automation_db_restored
INFO  [2025-11-10T09:10:28] Detected archive format
🔄 Restoring database 'test_automation_db_restored' from db_test_automation_db_20251110_090958.dump
INFO  [2025-11-10T09:10:28] Executing restore command
INFO  [2025-11-10T09:10:28] Restore command completed successfully
✅ Database 'test_automation_db_restored' restored successfully
INFO  [2025-11-10T09:10:28] [Single Database Restore] COMPLETED: Restored database 'test_automation_db_restored' from db_test_automation_db_20251110_090958.dump (0.0s)
INFO  [2025-11-10T09:10:28] ✅ Restore completed successfully database=test_automation_db_restored
---
✅ PASS: Restore single with --clean flag
[09:10:28] Running: Restore single with --create flag
Command: sudo -u postgres ./dbbackup restore single /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump --target=test_automation_db_created --create --confirm
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:28] Archive information
INFO  [2025-11-10T09:10:28] Validating archive...
INFO  [2025-11-10T09:10:28] Checking disk space...
INFO  [2025-11-10T09:10:28] Disk space check passed
INFO  [2025-11-10T09:10:28] Starting restore... database=test_automation_db_created
INFO  [2025-11-10T09:10:28] Detected archive format
🔄 Restoring database 'test_automation_db_created' from db_test_automation_db_20251110_090958.dump
INFO  [2025-11-10T09:10:28] Checking if target database exists database=test_automation_db_created
INFO  [2025-11-10T09:10:28] Creating database
INFO  [2025-11-10T09:10:28] Successfully created database
INFO  [2025-11-10T09:10:28] Executing restore command
INFO  [2025-11-10T09:10:28] Restore command completed successfully
✅ Database 'test_automation_db_created' restored successfully
INFO  [2025-11-10T09:10:28] [Single Database Restore] COMPLETED: Restored database 'test_automation_db_created' from db_test_automation_db_20251110_090958.dump (0.1s)
INFO  [2025-11-10T09:10:28] ✅ Restore completed successfully database=test_automation_db_created
---
✅ PASS: Restore single with --create flag
[09:10:28] Running: Restore single with --dry-run
Command: sudo -u postgres ./dbbackup restore single /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump --target=test_automation_db_restored --dry-run
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:28] Archive information
INFO  [2025-11-10T09:10:28] Validating archive...
INFO  [2025-11-10T09:10:28] Checking disk space...
INFO  [2025-11-10T09:10:28] Disk space check passed
🔍 DRY-RUN MODE - No changes will be made
Would restore:
Archive: /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump
Format: PostgreSQL Dump
Target Database: test_automation_db_restored
Clean Before Restore: false
Create If Missing: false
To execute this restore, add --confirm flag
---
✅ PASS: Restore single with --dry-run
[09:10:28] Running: Restore single with --verbose
Command: sudo -u postgres ./dbbackup restore single /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump --target=test_automation_db_restored --verbose --confirm
Exit Code: 1
Output:
INFO  [2025-11-10T09:10:28] Archive information
INFO  [2025-11-10T09:10:28] Validating archive...
INFO  [2025-11-10T09:10:28] Checking disk space...
INFO  [2025-11-10T09:10:28] Disk space check passed
INFO  [2025-11-10T09:10:28] Starting restore... database=test_automation_db_restored
INFO  [2025-11-10T09:10:28] Detected archive format
🔄 Restoring database 'test_automation_db_restored' from db_test_automation_db_20251110_090958.dump
INFO  [2025-11-10T09:10:28] Executing restore command
ERROR [2025-11-10T09:10:28] Restore command failed error=exit status 1
❌ Restore failed: restore failed: exit status 1
Output: pg_restore: error: could not execute query: ERROR: relation "test_table" already exists
Command was: CREATE TABLE public.test_table (
id integer NOT NULL,
data text
);
ERROR [2025-11-10T09:10:28] [Single Database Restore] FAILED: Restore failed: restore failed: exit status 1
Output: pg_restore: error: could not execute query: ERROR: relation "test_table" already exists
Command was: CREATE TABLE public.test_table (
id integer NOT NULL,
data text
);
(0.0s)
Error: restore failed: restore failed: exit status 1
Output: pg_restore: error: could not execute query: ERROR: relation "test_table" already exists
Command was: CREATE TABLE public.test_table (
id integer NOT NULL,
data text
);
Usage:
dbbackup restore single [archive-file] [flags]
Flags:
--clean Drop and recreate target database
--confirm Confirm and execute restore (required)
--create Create target database if it doesn't exist
--dry-run Show what would be done without executing
--force Skip safety checks and confirmations
-h, --help help for single
--no-progress Disable progress indicators
--target string Target database name (defaults to original)
---
❌ FAIL: Restore single with --verbose (exit code: 1)
[09:10:28] Running: Restore single with --force
Command: sudo -u postgres ./dbbackup restore single /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump --target=test_automation_db_restored --force --confirm
Exit Code: 1
Output:
INFO  [2025-11-10T09:10:28] Archive information
INFO  [2025-11-10T09:10:28] Starting restore... database=test_automation_db_restored
INFO  [2025-11-10T09:10:28] Detected archive format
🔄 Restoring database 'test_automation_db_restored' from db_test_automation_db_20251110_090958.dump
INFO  [2025-11-10T09:10:28] Executing restore command
ERROR [2025-11-10T09:10:28] Restore command failed error=exit status 1
❌ Restore failed: restore failed: exit status 1
Output: pg_restore: error: could not execute query: ERROR: relation "test_table" already exists
Command was: CREATE TABLE public.test_table (
id integer NOT NULL,
data text
);
ERROR [2025-11-10T09:10:28] [Single Database Restore] FAILED: Restore failed: restore failed: exit status 1
Output: pg_restore: error: could not execute query: ERROR: relation "test_table" already exists
Command was: CREATE TABLE public.test_table (
id integer NOT NULL,
data text
);
(0.0s)
Error: restore failed: restore failed: exit status 1
Output: pg_restore: error: could not execute query: ERROR: relation "test_table" already exists
Command was: CREATE TABLE public.test_table (
id integer NOT NULL,
data text
);
Usage:
dbbackup restore single [archive-file] [flags]
Flags:
--clean Drop and recreate target database
--confirm Confirm and execute restore (required)
--create Create target database if it doesn't exist
--dry-run Show what would be done without executing
--force Skip safety checks and confirmations
-h, --help help for single
--no-progress Disable progress indicators
--target string Target database name (defaults to original)
--verbose Show detailed restore progress
Global Flags:
---
❌ FAIL: Restore single with --force (exit code: 1)
[09:10:28] Running: Restore single without --confirm (should show dry-run)
Command: sudo -u postgres ./dbbackup restore single /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump --target=test_automation_db_restored
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:28] Archive information
INFO  [2025-11-10T09:10:28] Validating archive...
INFO  [2025-11-10T09:10:28] Checking disk space...
INFO  [2025-11-10T09:10:28] Disk space check passed
🔍 DRY-RUN MODE - No changes will be made
Would restore:
Archive: /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump
Format: PostgreSQL Dump
Target Database: test_automation_db_restored
Clean Before Restore: false
Create If Missing: false
To execute this restore, add --confirm flag
---
✅ PASS: Restore single without --confirm (should show dry-run)
[09:10:28] Running: Restore non-existent file (should fail)
Command: sudo -u postgres ./dbbackup restore single /tmp/nonexistent_file.dump --confirm
Exit Code: 1
Output:
Error: archive not found: /tmp/nonexistent_file.dump
Usage:
dbbackup restore single [archive-file] [flags]
Flags:
--clean Drop and recreate target database
--confirm Confirm and execute restore (required)
--create Create target database if it doesn't exist
--dry-run Show what would be done without executing
--force Skip safety checks and confirmations
-h, --help help for single
--no-progress Disable progress indicators
--target string Target database name (defaults to original)
--verbose Show detailed restore progress
Global Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/var/lib/pgsql/db_backups")
--compression int Compression level (0-9) (default 6)
--cpu-workload string CPU workload type (cpu-intensive|io-intensive|balanced) (default "balanced")
--database string Database name (default "postgres")
-d, --db-type string Database type (postgres|mysql|mariadb) (default "postgres")
--debug Enable debug logging
--dump-jobs int Number of parallel dump jobs (default 8)
--host string Database host (default "localhost")
--insecure Disable SSL (shortcut for --ssl-mode=disable)
--jobs int Number of parallel jobs (default 8)
--max-cores int Maximum CPU cores to use (default 16)
--no-color Disable colored output
--password string Database password
--port int Database port (default 5432)
--ssl-mode string SSL mode for connections (default "prefer")
--user string Database user (default "postgres")
ERROR [2025-11-10T09:10:28] Application failed error=archive not found: /tmp/nonexistent_file.dump
---
✅ PASS: Restore non-existent file (should fail) (correctly failed)
================================================================
6. Restore Cluster
================================================================
[09:10:28] Using cluster backup: /var/lib/pgsql/db_backups/cluster_20251110_091022.tar.gz
[09:10:28] Running: Restore cluster with --dry-run
Command: sudo -u postgres ./dbbackup restore cluster /var/lib/pgsql/db_backups/cluster_20251110_091022.tar.gz --dry-run
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:28] Cluster archive information
INFO  [2025-11-10T09:10:28] Validating archive...
INFO  [2025-11-10T09:10:28] Checking disk space...
INFO  [2025-11-10T09:10:28] Disk space check passed
🔍 DRY-RUN MODE - No changes will be made
Would restore cluster:
Archive: /var/lib/pgsql/db_backups/cluster_20251110_091022.tar.gz
Parallel Jobs: 0 (0 = auto)
To execute this restore, add --confirm flag
---
✅ PASS: Restore cluster with --dry-run
[09:10:28] Running: Restore cluster with --verbose
Command: sudo -u postgres ./dbbackup restore cluster /var/lib/pgsql/db_backups/cluster_20251110_091022.tar.gz --verbose --confirm
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:28] Cluster archive information
INFO  [2025-11-10T09:10:28] Validating archive...
INFO  [2025-11-10T09:10:28] Checking disk space...
INFO  [2025-11-10T09:10:28] Disk space check passed
INFO  [2025-11-10T09:10:28] Starting cluster restore...
🔄 Restoring cluster from cluster_20251110_091022.tar.gz
INFO  [2025-11-10T09:10:28] Extracting cluster archive
Checking privileges...
INFO  [2025-11-10T09:10:29] Superuser privileges confirmed - full ownership restoration enabled
INFO  [2025-11-10T09:10:29] Restoring global objects (roles, tablespaces)
Restoring global objects (roles, tablespaces)...
INFO  [2025-11-10T09:10:29] Successfully restored global objects
Restoring database backup_test_db (1/16) | 0/16 | Starting...
INFO  [2025-11-10T09:10:29] Restoring database
INFO  [2025-11-10T09:10:29] Dropping existing database for clean restore
INFO  [2025-11-10T09:10:29] Dropped existing database
INFO  [2025-11-10T09:10:29] Creating database
INFO  [2025-11-10T09:10:29] Successfully created database
INFO  [2025-11-10T09:10:29] Restoring database database=backup_test_db
INFO  [2025-11-10T09:10:29] Executing restore command
INFO  [2025-11-10T09:10:31] Restore command completed successfully
Restoring database cli_test_db (2/16) | 1/16 (6%) | Elapsed: 2s | ETA: ~36s remaining
INFO  [2025-11-10T09:10:31] Restoring database
INFO  [2025-11-10T09:10:31] Dropping existing database for clean restore
INFO  [2025-11-10T09:10:32] Dropped existing database
INFO  [2025-11-10T09:10:32] Creating database
INFO  [2025-11-10T09:10:32] Successfully created database
INFO  [2025-11-10T09:10:32] Restoring database database=cli_test_db
INFO  [2025-11-10T09:10:32] Executing restore command
INFO  [2025-11-10T09:10:32] Restore command completed successfully
Restoring database cluster_restore_test (3/16) | 2/16 (12%) | Elapsed: 3s | ETA: ~23s remaining
INFO  [2025-11-10T09:10:32] Restoring database
INFO  [2025-11-10T09:10:32] Dropping existing database for clean restore
INFO  [2025-11-10T09:10:33] Dropped existing database
INFO  [2025-11-10T09:10:33] Creating database
INFO  [2025-11-10T09:10:33] Successfully created database
INFO  [2025-11-10T09:10:33] Restoring database database=cluster_restore_test
INFO  [2025-11-10T09:10:33] Executing restore command
INFO  [2025-11-10T09:10:33] Restore command completed successfully
Restoring database final_test_db (4/16) | 3/16 (19%) | Elapsed: 4s | ETA: ~17s remaining
INFO  [2025-11-10T09:10:33] Restoring database
INFO  [2025-11-10T09:10:33] Dropping existing database for clean restore
INFO  [2025-11-10T09:10:33] Dropped existing database
INFO  [2025-11-10T09:10:33] Creating database
INFO  [2025-11-10T09:10:33] Successfully created database
INFO  [2025-11-10T09:10:33] Restoring database database=final_test_db
INFO  [2025-11-10T09:10:33] Executing restore command
INFO  [2025-11-10T09:10:33] Restore command completed successfully
Restoring database large_test_db (5/16) | 4/16 (25%) | Elapsed: 4s | ETA: ~14s remaining
---
✅ PASS: Restore cluster with --verbose
[09:10:42] Running: Restore cluster with --force
Command: sudo -u postgres ./dbbackup restore cluster /var/lib/pgsql/db_backups/cluster_20251110_091022.tar.gz --force --confirm
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:42] Cluster archive information
INFO  [2025-11-10T09:10:42] Starting cluster restore...
🔄 Restoring cluster from cluster_20251110_091022.tar.gz
INFO  [2025-11-10T09:10:42] Extracting cluster archive
Checking privileges...
INFO  [2025-11-10T09:10:43] Superuser privileges confirmed - full ownership restoration enabled
INFO  [2025-11-10T09:10:43] Restoring global objects (roles, tablespaces)
Restoring global objects (roles, tablespaces)...
INFO  [2025-11-10T09:10:43] Successfully restored global objects
Restoring database backup_test_db (1/16) | 0/16 | Starting...
INFO  [2025-11-10T09:10:43] Restoring database
INFO  [2025-11-10T09:10:43] Dropping existing database for clean restore
INFO  [2025-11-10T09:10:44] Dropped existing database
INFO  [2025-11-10T09:10:44] Creating database
INFO  [2025-11-10T09:10:44] Successfully created database
INFO  [2025-11-10T09:10:44] Restoring database database=backup_test_db
INFO  [2025-11-10T09:10:44] Executing restore command
INFO  [2025-11-10T09:10:45] Restore command completed successfully
Restoring database cli_test_db (2/16) | 1/16 (6%) | Elapsed: 2s | ETA: ~35s remaining
INFO  [2025-11-10T09:10:45] Restoring database
INFO  [2025-11-10T09:10:45] Dropping existing database for clean restore
INFO  [2025-11-10T09:10:46] Dropped existing database
INFO  [2025-11-10T09:10:46] Creating database
INFO  [2025-11-10T09:10:46] Successfully created database
INFO  [2025-11-10T09:10:46] Restoring database database=cli_test_db
INFO  [2025-11-10T09:10:46] Executing restore command
INFO  [2025-11-10T09:10:46] Restore command completed successfully
Restoring database cluster_restore_test (3/16) | 2/16 (12%) | Elapsed: 3s | ETA: ~22s remaining
INFO  [2025-11-10T09:10:46] Restoring database
INFO  [2025-11-10T09:10:46] Dropping existing database for clean restore
INFO  [2025-11-10T09:10:47] Dropped existing database
INFO  [2025-11-10T09:10:47] Creating database
INFO  [2025-11-10T09:10:47] Successfully created database
INFO  [2025-11-10T09:10:47] Restoring database database=cluster_restore_test
INFO  [2025-11-10T09:10:47] Executing restore command
INFO  [2025-11-10T09:10:47] Restore command completed successfully
Restoring database final_test_db (4/16) | 3/16 (19%) | Elapsed: 3s | ETA: ~17s remaining
INFO  [2025-11-10T09:10:47] Restoring database
INFO  [2025-11-10T09:10:47] Dropping existing database for clean restore
INFO  [2025-11-10T09:10:48] Dropped existing database
INFO  [2025-11-10T09:10:48] Creating database
INFO  [2025-11-10T09:10:48] Successfully created database
INFO  [2025-11-10T09:10:48] Restoring database database=final_test_db
INFO  [2025-11-10T09:10:48] Executing restore command
INFO  [2025-11-10T09:10:48] Restore command completed successfully
Restoring database large_test_db (5/16) | 4/16 (25%) | Elapsed: 4s | ETA: ~14s remaining
INFO  [2025-11-10T09:10:48] Restoring database
INFO  [2025-11-10T09:10:48] Dropping existing database for clean restore
INFO  [2025-11-10T09:10:48] Dropped existing database
---
✅ PASS: Restore cluster with --force
[09:10:57] Running: Restore cluster with --jobs=2
Command: sudo -u postgres ./dbbackup restore cluster /var/lib/pgsql/db_backups/cluster_20251110_091022.tar.gz --jobs=2 --confirm
Exit Code: 0
Output:
INFO  [2025-11-10T09:10:57] Cluster archive information
INFO  [2025-11-10T09:10:57] Validating archive...
INFO  [2025-11-10T09:10:57] Checking disk space...
INFO  [2025-11-10T09:10:57] Disk space check passed
INFO  [2025-11-10T09:10:57] Starting cluster restore...
🔄 Restoring cluster from cluster_20251110_091022.tar.gz
INFO  [2025-11-10T09:10:57] Extracting cluster archive
Checking privileges...
INFO  [2025-11-10T09:10:57] Superuser privileges confirmed - full ownership restoration enabled
INFO  [2025-11-10T09:10:57] Restoring global objects (roles, tablespaces)
Restoring global objects (roles, tablespaces)...
INFO  [2025-11-10T09:10:57] Successfully restored global objects
Restoring database backup_test_db (1/16) | 0/16 | Starting...
INFO  [2025-11-10T09:10:57] Restoring database
INFO  [2025-11-10T09:10:57] Dropping existing database for clean restore
INFO  [2025-11-10T09:10:58] Dropped existing database
INFO  [2025-11-10T09:10:58] Creating database
INFO  [2025-11-10T09:10:58] Successfully created database
INFO  [2025-11-10T09:10:58] Restoring database database=backup_test_db
INFO  [2025-11-10T09:10:58] Executing restore command
INFO  [2025-11-10T09:10:59] Restore command completed successfully
Restoring database cli_test_db (2/16) | 1/16 (6%) | Elapsed: 2s | ETA: ~35s remaining
INFO  [2025-11-10T09:10:59] Restoring database
INFO  [2025-11-10T09:10:59] Dropping existing database for clean restore
INFO  [2025-11-10T09:11:00] Dropped existing database
INFO  [2025-11-10T09:11:00] Creating database
INFO  [2025-11-10T09:11:00] Successfully created database
INFO  [2025-11-10T09:11:00] Restoring database database=cli_test_db
INFO  [2025-11-10T09:11:00] Executing restore command
INFO  [2025-11-10T09:11:00] Restore command completed successfully
Restoring database cluster_restore_test (3/16) | 2/16 (12%) | Elapsed: 3s | ETA: ~22s remaining
INFO  [2025-11-10T09:11:00] Restoring database
INFO  [2025-11-10T09:11:00] Dropping existing database for clean restore
INFO  [2025-11-10T09:11:01] Dropped existing database
INFO  [2025-11-10T09:11:01] Creating database
INFO  [2025-11-10T09:11:01] Successfully created database
INFO  [2025-11-10T09:11:01] Restoring database database=cluster_restore_test
INFO  [2025-11-10T09:11:01] Executing restore command
INFO  [2025-11-10T09:11:01] Restore command completed successfully
Restoring database final_test_db (4/16) | 3/16 (19%) | Elapsed: 3s | ETA: ~16s remaining
INFO  [2025-11-10T09:11:01] Restoring database
INFO  [2025-11-10T09:11:01] Dropping existing database for clean restore
INFO  [2025-11-10T09:11:02] Dropped existing database
INFO  [2025-11-10T09:11:02] Creating database
INFO  [2025-11-10T09:11:02] Successfully created database
INFO  [2025-11-10T09:11:02] Restoring database database=final_test_db
INFO  [2025-11-10T09:11:02] Executing restore command
INFO  [2025-11-10T09:11:02] Restore command completed successfully
Restoring database large_test_db (5/16) | 4/16 (25%) | Elapsed: 4s | ETA: ~13s remaining
---
✅ PASS: Restore cluster with --jobs=2
[09:11:11] Running: Restore cluster without --confirm (should show dry-run)
Command: sudo -u postgres ./dbbackup restore cluster /var/lib/pgsql/db_backups/cluster_20251110_091022.tar.gz
Exit Code: 0
Output:
INFO  [2025-11-10T09:11:11] Cluster archive information
INFO  [2025-11-10T09:11:11] Validating archive...
INFO  [2025-11-10T09:11:11] Checking disk space...
INFO  [2025-11-10T09:11:11] Disk space check passed
🔍 DRY-RUN MODE - No changes will be made
Would restore cluster:
Archive: /var/lib/pgsql/db_backups/cluster_20251110_091022.tar.gz
Parallel Jobs: 0 (0 = auto)
To execute this restore, add --confirm flag
---
✅ PASS: Restore cluster without --confirm (should show dry-run)
================================================================
7. Global Flags
================================================================
[09:11:11] Running: Custom host flag
Command: sudo -u postgres ./dbbackup status --host=localhost
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Checking required tools...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: Custom host flag
[09:11:11] Running: Custom port flag
Command: sudo -u postgres ./dbbackup status --port=5432
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Checking required tools...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: Custom port flag
[09:11:11] Running: Custom user flag
Command: sudo -u postgres ./dbbackup status --user=postgres
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Connecting to postgres...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: Custom user flag
[09:11:11] Running: Database type postgres
Command: sudo -u postgres ./dbbackup status --db-type=postgres
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
⠋ Checking required tools...
✅ Required tools available
INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully max_conns=10 driver=pgx
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: Database type postgres
[09:11:11] Running: SSL mode disable (insecure)
Command: sudo -u postgres ./dbbackup status --insecure
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
SSL: disabled
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Checking required tools...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully max_conns=10 driver=pgx
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: SSL mode disable (insecure)
[09:11:11] Running: SSL mode require
Command: sudo -u postgres ./dbbackup status --ssl-mode=require
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: require
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Checking required tools...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
❌ FAIL: SSL mode require (should have failed)
[09:11:11] Running: SSL mode prefer
Command: sudo -u postgres ./dbbackup status --ssl-mode=prefer
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Connecting to postgres...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully max_conns=10 driver=pgx
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: SSL mode prefer
[09:11:11] Running: Max cores flag
Command: sudo -u postgres ./dbbackup status --max-cores=4
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 4
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Connecting to postgres...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: Max cores flag
[09:11:11] Running: Disable auto-detect cores
Command: sudo -u postgres ./dbbackup status --auto-detect-cores=false
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: false
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Checking required tools...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: Disable auto-detect cores
[09:11:11] Running: CPU workload balanced
Command: sudo -u postgres ./dbbackup status --cpu-workload=balanced
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Connecting to postgres...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: CPU workload balanced
[09:11:11] Running: CPU workload cpu-intensive
Command: sudo -u postgres ./dbbackup status --cpu-workload=cpu-intensive
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Checking required tools...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully max_conns=10 driver=pgx
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: CPU workload cpu-intensive
[09:11:11] Running: CPU workload io-intensive
Command: sudo -u postgres ./dbbackup status --cpu-workload=io-intensive
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Checking required tools...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully max_conns=10 driver=pgx
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: CPU workload io-intensive
================================================================
8. Authentication Tests
================================================================
[09:11:11] Running: Connection with peer auth (default)
Command: sudo -u postgres ./dbbackup status
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Checking required tools...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: Connection with peer auth (default)
[09:11:11] Running: Connection with --user flag
Command: sudo -u postgres ./dbbackup status --user=postgres
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Connecting to postgres...INFO  [2025-11-10T09:11:11] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
✅ PASS: Connection with --user flag
[09:11:11] Running: Wrong user flag (should fail/warn)
Command: ./dbbackup status --user=postgres
Exit Code: 1
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /root/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /root/db_backups (exists, writable)
⠋ Checking required tools...
✅ Required tools available
❌ Connection failed: failed to ping PostgreSQL: failed to connect to `user=postgres database=postgres`:
127.0.0.1:5432 (localhost): tls error: server refused TLS connection
[::1]:5432 (localhost): tls error: server refused TLS connection
127.0.0.1:5432 (localhost): server error: FATAL: Ident authentication failed for user "postgres" (SQLSTATE 28000)
[::1]:5432 (localhost): server error: FATAL: Ident authentication failed for user "postgres" (SQLSTATE 28000)
Error: failed to ping PostgreSQL: failed to connect to `user=postgres database=postgres`:
127.0.0.1:5432 (localhost): tls error: server refused TLS connection
[::1]:5432 (localhost): tls error: server refused TLS connection
127.0.0.1:5432 (localhost): server error: FATAL: Ident authentication failed for user "postgres" (SQLSTATE 28000)
[::1]:5432 (localhost): server error: FATAL: Ident authentication failed for user "postgres" (SQLSTATE 28000)
Usage:
dbbackup status [flags]
Flags:
-h, --help help for status
Global Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/root/db_backups")
---
✅ PASS: Wrong user flag (should fail/warn) (correctly failed)
================================================================
9. Error Scenarios
================================================================
[09:11:12] Running: Invalid compression level (should fail)
Command: sudo -u postgres ./dbbackup backup single test_automation_db --compression=99
Exit Code: 1
Output:
Error: configuration error: config error in field 'compression' with value 'c': must be between 0-9
Usage:
dbbackup backup single [database] [flags]
Flags:
-h, --help help for single
Global Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/var/lib/pgsql/db_backups")
--compression int Compression level (0-9) (default 6)
--cpu-workload string CPU workload type (cpu-intensive|io-intensive|balanced) (default "balanced")
--database string Database name (default "postgres")
-d, --db-type string Database type (postgres|mysql|mariadb) (default "postgres")
--debug Enable debug logging
--dump-jobs int Number of parallel dump jobs (default 8)
--host string Database host (default "localhost")
--insecure Disable SSL (shortcut for --ssl-mode=disable)
--jobs int Number of parallel jobs (default 8)
--max-cores int Maximum CPU cores to use (default 16)
--no-color Disable colored output
--password string Database password
--port int Database port (default 5432)
--ssl-mode string SSL mode for connections (default "prefer")
--user string Database user (default "postgres")
ERROR [2025-11-10T09:11:12] Application failed error=configuration error: config error in field 'compression' with value 'c': must be between 0-9
---
✅ PASS: Invalid compression level (should fail) (correctly failed)
[09:11:12] Running: Invalid database type (should fail)
Command: sudo -u postgres ./dbbackup status --db-type=invalid
Exit Code: 1
Output:
Error: config error in field 'database-type' with value 'invalid': must be 'postgres', 'mysql', or 'mariadb'
Usage:
dbbackup status [flags]
Flags:
-h, --help help for status
Global Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/var/lib/pgsql/db_backups")
--compression int Compression level (0-9) (default 6)
--cpu-workload string CPU workload type (cpu-intensive|io-intensive|balanced) (default "balanced")
--database string Database name (default "postgres")
-d, --db-type string Database type (postgres|mysql|mariadb) (default "postgres")
--debug Enable debug logging
--dump-jobs int Number of parallel dump jobs (default 8)
--host string Database host (default "localhost")
--insecure Disable SSL (shortcut for --ssl-mode=disable)
--jobs int Number of parallel jobs (default 8)
--max-cores int Maximum CPU cores to use (default 16)
--no-color Disable colored output
--password string Database password
--port int Database port (default 5432)
--ssl-mode string SSL mode for connections (default "prefer")
--user string Database user (default "postgres")
ERROR [2025-11-10T09:11:12] Application failed error=config error in field 'database-type' with value 'invalid': must be 'postgres', 'mysql', or 'mariadb'
---
✅ PASS: Invalid database type (should fail) (correctly failed)
[09:11:12] Running: Invalid CPU workload (should fail)
Command: sudo -u postgres ./dbbackup status --cpu-workload=invalid
Exit Code: 0
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:5432
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
⠋ Checking required tools...
✅ Required tools available
INFO  [2025-11-10T09:11:12] Connected to PostgreSQL successfully driver=pgx max_conns=10
✅ Connected successfully
✅ Database operations successful
Connection Test Results:
Status: Connected ✅
Version: PostgreSQL 16.10 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 14.3.1 20250617 (Red Hat 14.3.1-2), 64-bit
Databases: 18 found
Database List: backup_test_db, cli_test_db, cluster_restore_test, ... (15 more)
✅ Status check completed successfully!
---
❌ FAIL: Invalid CPU workload (should fail) (should have failed)
[09:11:12] Running: Invalid port (should fail)
Command: sudo -u postgres ./dbbackup status --port=99999
Exit Code: 1
Output:
==============================================================
 Database Backup & Recovery Tool
==============================================================
Version: dev (built: unknown, commit: unknown)
Configuration:
Database Type: postgres
Host: localhost:99999
User: postgres
Database: postgres
Password: (not set)
SSL Mode: prefer
Backup Dir: /var/lib/pgsql/db_backups
Compression: 6
Jobs: 8
Dump Jobs: 8
Max Cores: 16
Auto Detect: true
System Information:
OS: linux/amd64
CPU Cores: 8
Go Version: go1.24.9
Backup Dir: /var/lib/pgsql/db_backups (exists, writable)
✅ Required tools available
⠋ Connecting to postgres...
❌ Connection failed: failed to parse pgx config: cannot parse `postgres://postgres@localhost:99999/postgres?sslmode=prefer&pool_max_conns=10&pool_min_conns=2&application_name=dbbackup&connect_timeout=30`: invalid port (strconv.ParseUint: parsing "99999": value out of range)
Error: failed to parse pgx config: cannot parse `postgres://postgres@localhost:99999/postgres?sslmode=prefer&pool_max_conns=10&pool_min_conns=2&application_name=dbbackup&connect_timeout=30`: invalid port (strconv.ParseUint: parsing "99999": value out of range)
Usage:
dbbackup status [flags]
Flags:
-h, --help help for status
Global Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/var/lib/pgsql/db_backups")
--compression int Compression level (0-9) (default 6)
--cpu-workload string CPU workload type (cpu-intensive|io-intensive|balanced) (default "balanced")
--database string Database name (default "postgres")
-d, --db-type string Database type (postgres|mysql|mariadb) (default "postgres")
--debug Enable debug logging
--dump-jobs int Number of parallel dump jobs (default 8)
--host string Database host (default "localhost")
--insecure Disable SSL (shortcut for --ssl-mode=disable)
---
✅ PASS: Invalid port (should fail) (correctly failed)
[09:11:12] Running: Backup to read-only directory (should fail)
Command: sudo -u postgres ./dbbackup backup single test_automation_db --backup-dir=/proc
Exit Code: 1
Output:
INFO  [2025-11-10T09:11:12] Starting single database backup database=test_automation_db
INFO  [2025-11-10T09:11:12] Connected to PostgreSQL successfully max_conns=10 driver=pgx
🔄 Starting backup: test_automation_db
INFO  [2025-11-10T09:11:12] Operation started
INFO  [2025-11-10T09:11:12] Step started
INFO  [2025-11-10T09:11:12] Step completed (38.439µs)
[10%] Backup directory prepared
[20%] Generated backup filename
INFO  [2025-11-10T09:11:12] Step started
INFO  [2025-11-10T09:11:12] Step completed (20.438µs)
[30%] Backup command prepared
INFO  [2025-11-10T09:11:12] Step started
[40%] Starting database backup...
ERROR [2025-11-10T09:11:12] Step failed error=backup execution failed: backup command failed: exit status 1 (8.879052ms)
❌ ❌ backup failed: backup command failed: exit status 1
ERROR [2025-11-10T09:11:12] Operation failed error=backup failed: backup command failed: exit status 1 (9.084599ms)
Error: backup failed: backup command failed: exit status 1
Usage:
dbbackup backup single [database] [flags]
Flags:
-h, --help help for single
Global Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/var/lib/pgsql/db_backups")
--compression int Compression level (0-9) (default 6)
--cpu-workload string CPU workload type (cpu-intensive|io-intensive|balanced) (default "balanced")
--database string Database name (default "postgres")
-d, --db-type string Database type (postgres|mysql|mariadb) (default "postgres")
--debug Enable debug logging
--dump-jobs int Number of parallel dump jobs (default 8)
--host string Database host (default "localhost")
--insecure Disable SSL (shortcut for --ssl-mode=disable)
--jobs int Number of parallel jobs (default 8)
--max-cores int Maximum CPU cores to use (default 16)
--no-color Disable colored output
--password string Database password
--port int Database port (default 5432)
--ssl-mode string SSL mode for connections (default "prefer")
--user string Database user (default "postgres")
ERROR [2025-11-10T09:11:12] Application failed error=backup failed: backup command failed: exit status 1
---
✅ PASS: Backup to read-only directory (should fail) (correctly failed)
================================================================
10. Interactive Mode
================================================================
[09:11:12] Running: Interactive mode help
Command: sudo -u postgres ./dbbackup interactive --help
Exit Code: 0
Output:
Start the interactive menu system for guided backup operations.
Usage:
dbbackup interactive [flags]
Aliases:
interactive, menu, ui
Flags:
-h, --help help for interactive
Global Flags:
--auto-detect-cores Auto-detect CPU cores (default true)
--backup-dir string Backup directory (default "/var/lib/pgsql/db_backups")
--compression int Compression level (0-9) (default 6)
--cpu-workload string CPU workload type (cpu-intensive|io-intensive|balanced) (default "balanced")
--database string Database name (default "postgres")
-d, --db-type string Database type (postgres|mysql|mariadb) (default "postgres")
--debug Enable debug logging
--dump-jobs int Number of parallel dump jobs (default 8)
--host string Database host (default "localhost")
--insecure Disable SSL (shortcut for --ssl-mode=disable)
--jobs int Number of parallel jobs (default 8)
--max-cores int Maximum CPU cores to use (default 16)
--no-color Disable colored output
--password string Database password
--port int Database port (default 5432)
--ssl-mode string SSL mode for connections (default "prefer")
--user string Database user (default "postgres")
---
✅ PASS: Interactive mode help
================================================================
Test Suite Summary
================================================================
Total Tests: 54
Passed: 48
Failed: 6
Skipped: 0
❌ FAIL: 6 test(s) failed
Results saved to: test_results_20251110_090957.txt
[09:11:12] Cleaning up test environment...
[09:11:12] Cleanup complete