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
|
docker-compose ps
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Verify Services
|
### 3. Initialize Restic Repositories
|
||||||
|
|
||||||
|
Before running any backup operations, you need to initialize the restic repositories:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Check if restic server is accessible
|
# Initialize repository for directory backups
|
||||||
curl -s http://localhost:8000/api/v1/repos
|
RESTIC_PASSWORD="testpassword123" restic -r "rest:http://localhost:8000/test-backup" init
|
||||||
|
|
||||||
# Check if PostgreSQL is accessible
|
# Initialize repository for PostgreSQL backups
|
||||||
docker exec postgres-test psql -U testuser -d testdb -c "SELECT version();"
|
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
|
## Directory Backup Testing
|
||||||
|
|
||||||
This section tests the directory backup and restore functionality.
|
This section tests the directory backup and restore functionality.
|
||||||
@@ -66,7 +70,7 @@ export OPERATION_MODE="backup"
|
|||||||
export BACKUP_MODE="directory"
|
export BACKUP_MODE="directory"
|
||||||
export RESTIC_PASSWORD="testpassword123"
|
export RESTIC_PASSWORD="testpassword123"
|
||||||
export RESTIC_REPOSITORY="rest:http://localhost:8000/test-backup"
|
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"
|
export ENABLE_GOTIFY="false"
|
||||||
|
|
||||||
# Run the backup
|
# Run the backup
|
||||||
@@ -87,11 +91,12 @@ restic -r "rest:http://localhost:8000/test-backup" ls latest --password-file <(e
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Create restore directory
|
# Create restore directory
|
||||||
mkdir -p restored_data
|
RESTOR_DIR="/tmp/restored_data"
|
||||||
|
mkdir -p $RESTOR_DIR
|
||||||
|
|
||||||
# Set environment variables for directory restore
|
# Set environment variables for directory restore
|
||||||
export OPERATION_MODE="restore"
|
export OPERATION_MODE="restore"
|
||||||
export RESTOREDIR="/home/tbehrendt/dev/backupsidecar/restored_data"
|
export RESTOREDIR=$RESTOR_DIR
|
||||||
export RESTORE_SNAPSHOT_ID="latest"
|
export RESTORE_SNAPSHOT_ID="latest"
|
||||||
|
|
||||||
# Run the restore
|
# Run the restore
|
||||||
@@ -102,7 +107,7 @@ export RESTORE_SNAPSHOT_ID="latest"
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Compare original and restored directories
|
# Compare original and restored directories
|
||||||
diff -r test_data restored_data
|
diff -r /tmp/test-data $RESTOR_DIR
|
||||||
|
|
||||||
# Check file contents
|
# Check file contents
|
||||||
echo "Original file:"
|
echo "Original file:"
|
||||||
@@ -310,6 +315,7 @@ rm -rf test_data restored_data
|
|||||||
2. **PostgreSQL connection failed**: Ensure the database container is fully initialized
|
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`)
|
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
|
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
|
### Debug Commands
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user