test: Add comprehensive command-line test suite
- Created test_suite.sh: Automated testing of all CLI options - Tests 54 different command combinations - Results: 48/54 passed (88.9% pass rate) - Generates detailed test_results_TIMESTAMP.txt file Test Coverage: - Backup operations (single & cluster) - Restore operations (single & cluster) - Global flags and options - Authentication scenarios - Error handling - SSL modes, compression levels, parallelization Issues Found (6 non-critical): - Custom backup directory handling - --verbose and --force flags in restore - Input validation for cpu-workload - SSL mode validation Added Documentation: - TEST_RESULTS_SUMMARY.md: Analysis of test results - INTERACTIVE_TEST_PLAN.md: TUI testing procedures
This commit is contained in:
2331
test_results_20251110_090957.txt
Normal file
2331
test_results_20251110_090957.txt
Normal file
@@ -0,0 +1,2331 @@
|
||||
|
||||
================================================================
|
||||
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
|
||||
|
||||
[0;34m[09:09:57][0m Setting up test environment...
|
||||
[0;34m[09:09:57][0m Test environment ready
|
||||
|
||||
================================================================
|
||||
1. Basic Commands
|
||||
================================================================
|
||||
[0;34m[09:09:57][0m 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")
|
||||
---
|
||||
[0;32m✅ PASS:[0m Help command
|
||||
[0;34m[09:09:57][0m Running: Version flag
|
||||
Command: sudo -u postgres ./dbbackup --version
|
||||
Exit Code: 0
|
||||
Output:
|
||||
dbbackup version dev (built: unknown, commit: unknown)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Version flag
|
||||
[0;34m[09:09:57][0m Running: Status command
|
||||
Command: sudo -u postgres ./dbbackup status
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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
|
||||
[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m Status command
|
||||
|
||||
================================================================
|
||||
2. Backup Single Database
|
||||
================================================================
|
||||
[0;34m[09:09:57][0m Running: Backup single database (basic)
|
||||
Command: sudo -u postgres ./dbbackup backup single test_automation_db
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Starting single database backup database=test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Connected to PostgreSQL successfully max_conns=10 driver=pgx
|
||||
|
||||
🔄 Starting backup: test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Operation started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step completed (29.487µs)
|
||||
[10%] Backup directory prepared
|
||||
[20%] Generated backup filename
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step completed (21.662µs)
|
||||
[30%] Backup command prepared
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[40%] Starting database backup...
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step completed (87.011298ms)
|
||||
[80%] Database backup completed
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step completed (45.019µs)
|
||||
[90%] Backup verified: 2.4 KB
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[32mINFO [0m [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
|
||||
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Operation completed (87.892633ms)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup single database (basic)
|
||||
[0;34m[09:09:57][0m Running: Backup single with compression level 9
|
||||
Command: sudo -u postgres ./dbbackup backup single test_automation_db --compression=9
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Starting single database backup database=test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting backup: test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Operation started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step completed (26.581µs)
|
||||
[10%] Backup directory prepared
|
||||
[20%] Generated backup filename
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step completed (10.12µs)
|
||||
[30%] Backup command prepared
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[40%] Starting database backup...
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step completed (94.738684ms)
|
||||
[80%] Database backup completed
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step completed (27.583µs)
|
||||
[90%] Backup verified: 2.4 KB
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[32mINFO [0m [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
|
||||
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Operation completed (95.17162ms)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup single with compression level 9
|
||||
[0;34m[09:09:57][0m Running: Backup single with compression level 1
|
||||
Command: sudo -u postgres ./dbbackup backup single test_automation_db --compression=1
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Starting single database backup database=test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting backup: test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Operation started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step completed (43.06µs)
|
||||
[10%] Backup directory prepared
|
||||
[20%] Generated backup filename
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step completed (22.425µs)
|
||||
[30%] Backup command prepared
|
||||
[32mINFO [0m [2025-11-10T09:09:57] Step started
|
||||
[40%] Starting database backup...
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (97.709995ms)
|
||||
[80%] Database backup completed
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (39.803µs)
|
||||
[90%] Backup verified: 2.4 KB
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [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
|
||||
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Operation completed (98.283211ms)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup single with compression level 1
|
||||
[0;34m[09:09:58][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Starting single database backup database=test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting backup: test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Operation started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (29.638µs)
|
||||
[10%] Backup directory prepared
|
||||
[20%] Generated backup filename
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (20.642µs)
|
||||
[30%] Backup command prepared
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[40%] Starting database backup...
|
||||
[31mERROR[0m [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
|
||||
|
||||
[31mERROR[0m [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")
|
||||
|
||||
[31mERROR[0m [2025-11-10T09:09:58] Application failed error=backup failed: backup command failed: exit status 1
|
||||
---
|
||||
[0;31m❌ FAIL:[0m Backup single with custom backup dir (exit code: 1)
|
||||
[0;34m[09:09:58][0m Running: Backup single with jobs=1
|
||||
Command: sudo -u postgres ./dbbackup backup single test_automation_db --jobs=1
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Starting single database backup database=test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting backup: test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Operation started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (24.798µs)
|
||||
[10%] Backup directory prepared
|
||||
[20%] Generated backup filename
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (9.769µs)
|
||||
[30%] Backup command prepared
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[40%] Starting database backup...
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (93.903526ms)
|
||||
[80%] Database backup completed
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (35.784µs)
|
||||
[90%] Backup verified: 2.4 KB
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [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
|
||||
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Operation completed (94.353115ms)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup single with jobs=1
|
||||
[0;34m[09:09:58][0m Running: Backup single with jobs=16
|
||||
Command: sudo -u postgres ./dbbackup backup single test_automation_db --jobs=16
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Starting single database backup database=test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting backup: test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Operation started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (26.215µs)
|
||||
[10%] Backup directory prepared
|
||||
[20%] Generated backup filename
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (13.906µs)
|
||||
[30%] Backup command prepared
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[40%] Starting database backup...
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (97.612874ms)
|
||||
[80%] Database backup completed
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (34.496µs)
|
||||
[90%] Backup verified: 2.4 KB
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [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
|
||||
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Operation completed (98.064382ms)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup single with jobs=16
|
||||
[0;34m[09:09:58][0m Running: Backup single non-existent database (should fail)
|
||||
Command: sudo -u postgres ./dbbackup backup single nonexistent_database_xyz
|
||||
Exit Code: 1
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Starting single database backup database=nonexistent_database_xyz
|
||||
[32mINFO [0m [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")
|
||||
|
||||
[31mERROR[0m [2025-11-10T09:09:58] Application failed error=database 'nonexistent_database_xyz' does not exist
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup single non-existent database (should fail) (correctly failed)
|
||||
[0;34m[09:09:58][0m Running: Backup single with debug logging
|
||||
Command: sudo -u postgres ./dbbackup backup single test_automation_db --debug
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Starting single database backup database=test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting backup: test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Operation started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (31.619µs)
|
||||
[10%] Backup directory prepared
|
||||
[20%] Generated backup filename
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (12.937µs)
|
||||
[30%] Backup command prepared
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[40%] Starting database backup...
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (94.583288ms)
|
||||
[80%] Database backup completed
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (43.511µs)
|
||||
[90%] Backup verified: 2.4 KB
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [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
|
||||
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Operation completed (95.097145ms)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup single with debug logging
|
||||
[0;34m[09:09:58][0m Running: Backup single with no-color
|
||||
Command: sudo -u postgres ./dbbackup backup single test_automation_db --no-color
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Starting single database backup database=test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting backup: test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Operation started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (30.472µs)
|
||||
[10%] Backup directory prepared
|
||||
[20%] Generated backup filename
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (23.534µs)
|
||||
[30%] Backup command prepared
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[40%] Starting database backup...
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (104.354812ms)
|
||||
[80%] Database backup completed
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step completed (44.888µs)
|
||||
[90%] Backup verified: 2.4 KB
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Step started
|
||||
[32mINFO [0m [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
|
||||
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Operation completed (104.973414ms)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup single with no-color
|
||||
|
||||
================================================================
|
||||
3. Backup Cluster
|
||||
================================================================
|
||||
[0;34m[09:09:58][0m Running: Backup cluster (basic)
|
||||
Command: sudo -u postgres ./dbbackup backup cluster
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Starting cluster backup
|
||||
[32mINFO [0m [2025-11-10T09:09:58] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting cluster backup (all databases)
|
||||
[32mINFO [0m [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)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup cluster (basic)
|
||||
[0;34m[09:10:04][0m Running: Backup cluster with compression 9
|
||||
Command: sudo -u postgres ./dbbackup backup cluster --compression=9
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:10:05] Starting cluster backup
|
||||
[32mINFO [0m [2025-11-10T09:10:05] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting cluster backup (all databases)
|
||||
[32mINFO [0m [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)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup cluster with compression 9
|
||||
[0;34m[09:10:10][0m Running: Backup cluster with jobs=4
|
||||
Command: sudo -u postgres ./dbbackup backup cluster --jobs=4
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:10:10] Starting cluster backup
|
||||
[32mINFO [0m [2025-11-10T09:10:10] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting cluster backup (all databases)
|
||||
[32mINFO [0m [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)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup cluster with jobs=4
|
||||
[0;34m[09:10:16][0m Running: Backup cluster with dump-jobs=4
|
||||
Command: sudo -u postgres ./dbbackup backup cluster --dump-jobs=4
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:10:16] Starting cluster backup
|
||||
[32mINFO [0m [2025-11-10T09:10:16] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting cluster backup (all databases)
|
||||
[32mINFO [0m [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)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup cluster with dump-jobs=4
|
||||
[0;34m[09:10:22][0m Running: Backup cluster with custom backup dir
|
||||
Command: sudo -u postgres ./dbbackup backup cluster --backup-dir=/tmp/test_backups_1046326
|
||||
Exit Code: 1
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:10:22] Starting cluster backup
|
||||
[32mINFO [0m [2025-11-10T09:10:22] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting cluster backup (all databases)
|
||||
[32mINFO [0m [2025-11-10T09:10:22] [Cluster Backup] Starting cluster backup
|
||||
[31mERROR[0m [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")
|
||||
|
||||
[31mERROR[0m [2025-11-10T09:10:22] Application failed error=failed to create temp directory: mkdir /tmp/test_backups_1046326/.cluster_20251110_091022: permission denied
|
||||
---
|
||||
[0;31m❌ FAIL:[0m Backup cluster with custom backup dir (exit code: 1)
|
||||
[0;34m[09:10:22][0m Running: Backup cluster with debug
|
||||
Command: sudo -u postgres ./dbbackup backup cluster --debug
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[32mINFO [0m [2025-11-10T09:10:22] Starting cluster backup
|
||||
[32mINFO [0m [2025-11-10T09:10:22] Connected to PostgreSQL successfully driver=pgx max_conns=10
|
||||
|
||||
🔄 Starting cluster backup (all databases)
|
||||
[32mINFO [0m [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)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup cluster with debug
|
||||
|
||||
================================================================
|
||||
4. Restore List
|
||||
================================================================
|
||||
[0;34m[09:10:27][0m 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
|
||||
---
|
||||
[0;32m✅ PASS:[0m List available backups
|
||||
[0;34m[09:10:27][0m 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
|
||||
---
|
||||
[0;32m✅ PASS:[0m List backups from custom dir
|
||||
|
||||
================================================================
|
||||
5. Restore Single Database
|
||||
================================================================
|
||||
[0;34m[09:10:27][0m Using backup file: /var/lib/pgsql/db_backups/db_test_automation_db_20251110_090958.dump
|
||||
[0;34m[09:10:27][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:27] Archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:27] Validating archive...
|
||||
[32mINFO [0m [2025-11-10T09:10:27] Checking disk space...
|
||||
[32mINFO [0m [2025-11-10T09:10:27] Disk space check passed
|
||||
[32mINFO [0m [2025-11-10T09:10:27] Starting restore... database=test_automation_db_restored
|
||||
[32mINFO [0m [2025-11-10T09:10:27] Detected archive format
|
||||
|
||||
🔄 Restoring database 'test_automation_db_restored' from db_test_automation_db_20251110_090958.dump
|
||||
[32mINFO [0m [2025-11-10T09:10:27] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:27] Restore command completed successfully
|
||||
✅ Database 'test_automation_db_restored' restored successfully
|
||||
|
||||
[32mINFO [0m [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)
|
||||
[32mINFO [0m [2025-11-10T09:10:27] ✅ Restore completed successfully database=test_automation_db_restored
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore single database (basic)
|
||||
[0;34m[09:10:28][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Validating archive...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Checking disk space...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Disk space check passed
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Starting restore... database=test_automation_db_restored
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Detected archive format
|
||||
|
||||
🔄 Restoring database 'test_automation_db_restored' from db_test_automation_db_20251110_090958.dump
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Restore command completed successfully
|
||||
✅ Database 'test_automation_db_restored' restored successfully
|
||||
|
||||
[32mINFO [0m [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)
|
||||
[32mINFO [0m [2025-11-10T09:10:28] ✅ Restore completed successfully database=test_automation_db_restored
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore single with --clean flag
|
||||
[0;34m[09:10:28][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Validating archive...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Checking disk space...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Disk space check passed
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Starting restore... database=test_automation_db_created
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Detected archive format
|
||||
|
||||
🔄 Restoring database 'test_automation_db_created' from db_test_automation_db_20251110_090958.dump
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Checking if target database exists database=test_automation_db_created
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Restore command completed successfully
|
||||
✅ Database 'test_automation_db_created' restored successfully
|
||||
|
||||
[32mINFO [0m [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)
|
||||
[32mINFO [0m [2025-11-10T09:10:28] ✅ Restore completed successfully database=test_automation_db_created
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore single with --create flag
|
||||
[0;34m[09:10:28][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Validating archive...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Checking disk space...
|
||||
[32mINFO [0m [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
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore single with --dry-run
|
||||
[0;34m[09:10:28][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Validating archive...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Checking disk space...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Disk space check passed
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Starting restore... database=test_automation_db_restored
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Detected archive format
|
||||
|
||||
🔄 Restoring database 'test_automation_db_restored' from db_test_automation_db_20251110_090958.dump
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Executing restore command
|
||||
[31mERROR[0m [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
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
[31mERROR[0m [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)
|
||||
---
|
||||
[0;31m❌ FAIL:[0m Restore single with --verbose (exit code: 1)
|
||||
[0;34m[09:10:28][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Starting restore... database=test_automation_db_restored
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Detected archive format
|
||||
|
||||
🔄 Restoring database 'test_automation_db_restored' from db_test_automation_db_20251110_090958.dump
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Executing restore command
|
||||
[31mERROR[0m [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
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
[31mERROR[0m [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:
|
||||
---
|
||||
[0;31m❌ FAIL:[0m Restore single with --force (exit code: 1)
|
||||
[0;34m[09:10:28][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Validating archive...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Checking disk space...
|
||||
[32mINFO [0m [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
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore single without --confirm (should show dry-run)
|
||||
[0;34m[09:10:28][0m 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")
|
||||
|
||||
[31mERROR[0m [2025-11-10T09:10:28] Application failed error=archive not found: /tmp/nonexistent_file.dump
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore non-existent file (should fail) (correctly failed)
|
||||
|
||||
================================================================
|
||||
6. Restore Cluster
|
||||
================================================================
|
||||
[0;34m[09:10:28][0m Using cluster backup: /var/lib/pgsql/db_backups/cluster_20251110_091022.tar.gz
|
||||
[0;34m[09:10:28][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Cluster archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Validating archive...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Checking disk space...
|
||||
[32mINFO [0m [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
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore cluster with --dry-run
|
||||
[0;34m[09:10:28][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Cluster archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Validating archive...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Checking disk space...
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Disk space check passed
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Starting cluster restore...
|
||||
|
||||
🔄 Restoring cluster from cluster_20251110_091022.tar.gz
|
||||
[32mINFO [0m [2025-11-10T09:10:28] Extracting cluster archive
|
||||
Checking privileges...
|
||||
[32mINFO [0m [2025-11-10T09:10:29] Superuser privileges confirmed - full ownership restoration enabled
|
||||
[32mINFO [0m [2025-11-10T09:10:29] Restoring global objects (roles, tablespaces)
|
||||
Restoring global objects (roles, tablespaces)...
|
||||
[32mINFO [0m [2025-11-10T09:10:29] Successfully restored global objects
|
||||
Restoring database backup_test_db (1/16) | 0/16 | Starting...
|
||||
[32mINFO [0m [2025-11-10T09:10:29] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:29] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:10:29] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:10:29] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:10:29] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:10:29] Restoring database database=backup_test_db
|
||||
[32mINFO [0m [2025-11-10T09:10:29] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:31] Restore command completed successfully
|
||||
Restoring database cli_test_db (2/16) | 1/16 (6%) | Elapsed: 2s | ETA: ~36s remaining
|
||||
[32mINFO [0m [2025-11-10T09:10:31] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:31] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:10:32] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:10:32] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:10:32] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:10:32] Restoring database database=cli_test_db
|
||||
[32mINFO [0m [2025-11-10T09:10:32] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:32] Restore command completed successfully
|
||||
Restoring database cluster_restore_test (3/16) | 2/16 (12%) | Elapsed: 3s | ETA: ~23s remaining
|
||||
[32mINFO [0m [2025-11-10T09:10:32] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:32] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Restoring database database=cluster_restore_test
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Restore command completed successfully
|
||||
Restoring database final_test_db (4/16) | 3/16 (19%) | Elapsed: 4s | ETA: ~17s remaining
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Restoring database database=final_test_db
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:33] Restore command completed successfully
|
||||
Restoring database large_test_db (5/16) | 4/16 (25%) | Elapsed: 4s | ETA: ~14s remaining
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore cluster with --verbose
|
||||
[0;34m[09:10:42][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:42] Cluster archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:42] Starting cluster restore...
|
||||
|
||||
🔄 Restoring cluster from cluster_20251110_091022.tar.gz
|
||||
[32mINFO [0m [2025-11-10T09:10:42] Extracting cluster archive
|
||||
Checking privileges...
|
||||
[32mINFO [0m [2025-11-10T09:10:43] Superuser privileges confirmed - full ownership restoration enabled
|
||||
[32mINFO [0m [2025-11-10T09:10:43] Restoring global objects (roles, tablespaces)
|
||||
Restoring global objects (roles, tablespaces)...
|
||||
[32mINFO [0m [2025-11-10T09:10:43] Successfully restored global objects
|
||||
Restoring database backup_test_db (1/16) | 0/16 | Starting...
|
||||
[32mINFO [0m [2025-11-10T09:10:43] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:43] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:10:44] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:10:44] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:10:44] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:10:44] Restoring database database=backup_test_db
|
||||
[32mINFO [0m [2025-11-10T09:10:44] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:45] Restore command completed successfully
|
||||
Restoring database cli_test_db (2/16) | 1/16 (6%) | Elapsed: 2s | ETA: ~35s remaining
|
||||
[32mINFO [0m [2025-11-10T09:10:45] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:45] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:10:46] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:10:46] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:10:46] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:10:46] Restoring database database=cli_test_db
|
||||
[32mINFO [0m [2025-11-10T09:10:46] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:46] Restore command completed successfully
|
||||
Restoring database cluster_restore_test (3/16) | 2/16 (12%) | Elapsed: 3s | ETA: ~22s remaining
|
||||
[32mINFO [0m [2025-11-10T09:10:46] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:46] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:10:47] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:10:47] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:10:47] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:10:47] Restoring database database=cluster_restore_test
|
||||
[32mINFO [0m [2025-11-10T09:10:47] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:47] Restore command completed successfully
|
||||
Restoring database final_test_db (4/16) | 3/16 (19%) | Elapsed: 3s | ETA: ~17s remaining
|
||||
[32mINFO [0m [2025-11-10T09:10:47] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:47] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:10:48] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:10:48] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:10:48] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:10:48] Restoring database database=final_test_db
|
||||
[32mINFO [0m [2025-11-10T09:10:48] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:48] Restore command completed successfully
|
||||
Restoring database large_test_db (5/16) | 4/16 (25%) | Elapsed: 4s | ETA: ~14s remaining
|
||||
[32mINFO [0m [2025-11-10T09:10:48] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:48] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:10:48] Dropped existing database
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore cluster with --force
|
||||
[0;34m[09:10:57][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Cluster archive information
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Validating archive...
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Checking disk space...
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Disk space check passed
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Starting cluster restore...
|
||||
|
||||
🔄 Restoring cluster from cluster_20251110_091022.tar.gz
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Extracting cluster archive
|
||||
Checking privileges...
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Superuser privileges confirmed - full ownership restoration enabled
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Restoring global objects (roles, tablespaces)
|
||||
Restoring global objects (roles, tablespaces)...
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Successfully restored global objects
|
||||
Restoring database backup_test_db (1/16) | 0/16 | Starting...
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:57] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:10:58] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:10:58] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:10:58] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:10:58] Restoring database database=backup_test_db
|
||||
[32mINFO [0m [2025-11-10T09:10:58] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:10:59] Restore command completed successfully
|
||||
Restoring database cli_test_db (2/16) | 1/16 (6%) | Elapsed: 2s | ETA: ~35s remaining
|
||||
[32mINFO [0m [2025-11-10T09:10:59] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:10:59] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:11:00] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:11:00] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:11:00] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:11:00] Restoring database database=cli_test_db
|
||||
[32mINFO [0m [2025-11-10T09:11:00] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:11:00] Restore command completed successfully
|
||||
Restoring database cluster_restore_test (3/16) | 2/16 (12%) | Elapsed: 3s | ETA: ~22s remaining
|
||||
[32mINFO [0m [2025-11-10T09:11:00] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:11:00] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:11:01] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:11:01] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:11:01] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:11:01] Restoring database database=cluster_restore_test
|
||||
[32mINFO [0m [2025-11-10T09:11:01] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:11:01] Restore command completed successfully
|
||||
Restoring database final_test_db (4/16) | 3/16 (19%) | Elapsed: 3s | ETA: ~16s remaining
|
||||
[32mINFO [0m [2025-11-10T09:11:01] Restoring database
|
||||
[32mINFO [0m [2025-11-10T09:11:01] Dropping existing database for clean restore
|
||||
[32mINFO [0m [2025-11-10T09:11:02] Dropped existing database
|
||||
[32mINFO [0m [2025-11-10T09:11:02] Creating database
|
||||
[32mINFO [0m [2025-11-10T09:11:02] Successfully created database
|
||||
[32mINFO [0m [2025-11-10T09:11:02] Restoring database database=final_test_db
|
||||
[32mINFO [0m [2025-11-10T09:11:02] Executing restore command
|
||||
[32mINFO [0m [2025-11-10T09:11:02] Restore command completed successfully
|
||||
Restoring database large_test_db (5/16) | 4/16 (25%) | Elapsed: 4s | ETA: ~13s remaining
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore cluster with --jobs=2
|
||||
[0;34m[09:11:11][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:11:11] Cluster archive information
|
||||
[32mINFO [0m [2025-11-10T09:11:11] Validating archive...
|
||||
[32mINFO [0m [2025-11-10T09:11:11] Checking disk space...
|
||||
[32mINFO [0m [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
|
||||
---
|
||||
[0;32m✅ PASS:[0m Restore cluster without --confirm (should show dry-run)
|
||||
|
||||
================================================================
|
||||
7. Global Flags
|
||||
================================================================
|
||||
[0;34m[09:11:11][0m Running: Custom host flag
|
||||
Command: sudo -u postgres ./dbbackup status --host=localhost
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m Custom host flag
|
||||
[0;34m[09:11:11][0m Running: Custom port flag
|
||||
Command: sudo -u postgres ./dbbackup status --port=5432
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m Custom port flag
|
||||
[0;34m[09:11:11][0m Running: Custom user flag
|
||||
Command: sudo -u postgres ./dbbackup status --user=postgres
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m Custom user flag
|
||||
[0;34m[09:11:11][0m Running: Database type postgres
|
||||
Command: sudo -u postgres ./dbbackup status --db-type=postgres
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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
|
||||
[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m Database type postgres
|
||||
[0;34m[09:11:11][0m Running: SSL mode disable (insecure)
|
||||
Command: sudo -u postgres ./dbbackup status --insecure
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m SSL mode disable (insecure)
|
||||
[0;34m[09:11:11][0m Running: SSL mode require
|
||||
Command: sudo -u postgres ./dbbackup status --ssl-mode=require
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;31m❌ FAIL:[0m SSL mode require (should have failed)
|
||||
[0;34m[09:11:11][0m Running: SSL mode prefer
|
||||
Command: sudo -u postgres ./dbbackup status --ssl-mode=prefer
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m SSL mode prefer
|
||||
[0;34m[09:11:11][0m Running: Max cores flag
|
||||
Command: sudo -u postgres ./dbbackup status --max-cores=4
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m Max cores flag
|
||||
[0;34m[09:11:11][0m Running: Disable auto-detect cores
|
||||
Command: sudo -u postgres ./dbbackup status --auto-detect-cores=false
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m Disable auto-detect cores
|
||||
[0;34m[09:11:11][0m Running: CPU workload balanced
|
||||
Command: sudo -u postgres ./dbbackup status --cpu-workload=balanced
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m CPU workload balanced
|
||||
[0;34m[09:11:11][0m Running: CPU workload cpu-intensive
|
||||
Command: sudo -u postgres ./dbbackup status --cpu-workload=cpu-intensive
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m CPU workload cpu-intensive
|
||||
[0;34m[09:11:11][0m Running: CPU workload io-intensive
|
||||
Command: sudo -u postgres ./dbbackup status --cpu-workload=io-intensive
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m CPU workload io-intensive
|
||||
|
||||
================================================================
|
||||
8. Authentication Tests
|
||||
================================================================
|
||||
[0;34m[09:11:11][0m Running: Connection with peer auth (default)
|
||||
Command: sudo -u postgres ./dbbackup status
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m Connection with peer auth (default)
|
||||
[0;34m[09:11:11][0m Running: Connection with --user flag
|
||||
Command: sudo -u postgres ./dbbackup status --user=postgres
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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...[32mINFO [0m [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!
|
||||
---
|
||||
[0;32m✅ PASS:[0m Connection with --user flag
|
||||
[0;34m[09:11:11][0m Running: Wrong user flag (should fail/warn)
|
||||
Command: ./dbbackup status --user=postgres
|
||||
Exit Code: 1
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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")
|
||||
---
|
||||
[0;32m✅ PASS:[0m Wrong user flag (should fail/warn) (correctly failed)
|
||||
|
||||
================================================================
|
||||
9. Error Scenarios
|
||||
================================================================
|
||||
[0;34m[09:11:12][0m 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")
|
||||
|
||||
[31mERROR[0m [2025-11-10T09:11:12] Application failed error=configuration error: config error in field 'compression' with value 'c': must be between 0-9
|
||||
---
|
||||
[0;32m✅ PASS:[0m Invalid compression level (should fail) (correctly failed)
|
||||
[0;34m[09:11:12][0m 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")
|
||||
|
||||
[31mERROR[0m [2025-11-10T09:11:12] Application failed error=config error in field 'database-type' with value 'invalid': must be 'postgres', 'mysql', or 'mariadb'
|
||||
---
|
||||
[0;32m✅ PASS:[0m Invalid database type (should fail) (correctly failed)
|
||||
[0;34m[09:11:12][0m Running: Invalid CPU workload (should fail)
|
||||
Command: sudo -u postgres ./dbbackup status --cpu-workload=invalid
|
||||
Exit Code: 0
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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
|
||||
[32mINFO [0m [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!
|
||||
---
|
||||
[0;31m❌ FAIL:[0m Invalid CPU workload (should fail) (should have failed)
|
||||
[0;34m[09:11:12][0m Running: Invalid port (should fail)
|
||||
Command: sudo -u postgres ./dbbackup status --port=99999
|
||||
Exit Code: 1
|
||||
Output:
|
||||
[1;34m==============================================================[0m
|
||||
[1;37m Database Backup & Recovery Tool[0m
|
||||
[1;34m==============================================================[0m
|
||||
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)
|
||||
---
|
||||
[0;32m✅ PASS:[0m Invalid port (should fail) (correctly failed)
|
||||
[0;34m[09:11:12][0m 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:
|
||||
[32mINFO [0m [2025-11-10T09:11:12] Starting single database backup database=test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:11:12] Connected to PostgreSQL successfully max_conns=10 driver=pgx
|
||||
|
||||
🔄 Starting backup: test_automation_db
|
||||
[32mINFO [0m [2025-11-10T09:11:12] Operation started
|
||||
[32mINFO [0m [2025-11-10T09:11:12] Step started
|
||||
[32mINFO [0m [2025-11-10T09:11:12] Step completed (38.439µs)
|
||||
[10%] Backup directory prepared
|
||||
[20%] Generated backup filename
|
||||
[32mINFO [0m [2025-11-10T09:11:12] Step started
|
||||
[32mINFO [0m [2025-11-10T09:11:12] Step completed (20.438µs)
|
||||
[30%] Backup command prepared
|
||||
[32mINFO [0m [2025-11-10T09:11:12] Step started
|
||||
[40%] Starting database backup...
|
||||
[31mERROR[0m [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
|
||||
|
||||
[31mERROR[0m [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")
|
||||
|
||||
[31mERROR[0m [2025-11-10T09:11:12] Application failed error=backup failed: backup command failed: exit status 1
|
||||
---
|
||||
[0;32m✅ PASS:[0m Backup to read-only directory (should fail) (correctly failed)
|
||||
|
||||
================================================================
|
||||
10. Interactive Mode
|
||||
================================================================
|
||||
[0;34m[09:11:12][0m 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")
|
||||
---
|
||||
[0;32m✅ PASS:[0m Interactive mode help
|
||||
|
||||
================================================================
|
||||
Test Suite Summary
|
||||
================================================================
|
||||
|
||||
Total Tests: 54
|
||||
Passed: 48
|
||||
Failed: 6
|
||||
Skipped: 0
|
||||
|
||||
[0;31m❌ FAIL:[0m 6 test(s) failed
|
||||
|
||||
Results saved to: test_results_20251110_090957.txt
|
||||
|
||||
[0;34m[09:11:12][0m Cleaning up test environment...
|
||||
[0;34m[09:11:12][0m Cleanup complete
|
||||
Reference in New Issue
Block a user