adjust testing procedure
All checks were successful
CI / Build Docker image (pull_request) Successful in 17s
All checks were successful
CI / Build Docker image (pull_request) Successful in 17s
This commit is contained in:
24
TESTING.md
24
TESTING.md
@@ -23,16 +23,20 @@ sleep 15
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
### 2. Verify Services
|
||||
### 3. Initialize Restic Repositories
|
||||
|
||||
Before running any backup operations, you need to initialize the restic repositories:
|
||||
|
||||
```bash
|
||||
# Check if restic server is accessible
|
||||
curl -s http://localhost:8000/api/v1/repos
|
||||
# Initialize repository for directory backups
|
||||
RESTIC_PASSWORD="testpassword123" restic -r "rest:http://localhost:8000/test-backup" init
|
||||
|
||||
# Check if PostgreSQL is accessible
|
||||
docker exec postgres-test psql -U testuser -d testdb -c "SELECT version();"
|
||||
# Initialize repository for PostgreSQL backups
|
||||
RESTIC_PASSWORD="testpassword123" restic -r "rest:http://localhost:8000/postgres-backup" init
|
||||
```
|
||||
|
||||
**Note**: The repositories only need to be initialized once. If you recreate the restic server container, you'll need to reinitialize the repositories.
|
||||
|
||||
## Directory Backup Testing
|
||||
|
||||
This section tests the directory backup and restore functionality.
|
||||
@@ -66,7 +70,7 @@ export OPERATION_MODE="backup"
|
||||
export BACKUP_MODE="directory"
|
||||
export RESTIC_PASSWORD="testpassword123"
|
||||
export RESTIC_REPOSITORY="rest:http://localhost:8000/test-backup"
|
||||
export SOURCEDIR="/home/tbehrendt/dev/backupsidecar/test_data"
|
||||
export SOURCEDIR="/tmp/test-data"
|
||||
export ENABLE_GOTIFY="false"
|
||||
|
||||
# Run the backup
|
||||
@@ -87,11 +91,12 @@ restic -r "rest:http://localhost:8000/test-backup" ls latest --password-file <(e
|
||||
|
||||
```bash
|
||||
# Create restore directory
|
||||
mkdir -p restored_data
|
||||
RESTOR_DIR="/tmp/restored_data"
|
||||
mkdir -p $RESTOR_DIR
|
||||
|
||||
# Set environment variables for directory restore
|
||||
export OPERATION_MODE="restore"
|
||||
export RESTOREDIR="/home/tbehrendt/dev/backupsidecar/restored_data"
|
||||
export RESTOREDIR=$RESTOR_DIR
|
||||
export RESTORE_SNAPSHOT_ID="latest"
|
||||
|
||||
# Run the restore
|
||||
@@ -102,7 +107,7 @@ export RESTORE_SNAPSHOT_ID="latest"
|
||||
|
||||
```bash
|
||||
# Compare original and restored directories
|
||||
diff -r test_data restored_data
|
||||
diff -r /tmp/test-data $RESTOR_DIR
|
||||
|
||||
# Check file contents
|
||||
echo "Original file:"
|
||||
@@ -310,6 +315,7 @@ rm -rf test_data restored_data
|
||||
2. **PostgreSQL connection failed**: Ensure the database container is fully initialized
|
||||
3. **Permission denied**: Make sure the backup script is executable (`chmod +x src/backup.sh`)
|
||||
4. **Restic repository not found**: Check that the repository URL is correct and the server is running
|
||||
5. **Script exits early with no output**: The restic repository hasn't been initialized yet. Run the initialization commands in step 3 above.
|
||||
|
||||
### Debug Commands
|
||||
|
||||
|
||||
Reference in New Issue
Block a user