Fix test email generator to use correct Veeam format and consistent job name

Changed test emails to use proper Veeam Backup Job format that matches parser
expectations. All test emails now use the same job name "Test-Backup-Job" so
they appear as different runs of the same job, enabling proper status testing.

Changes:
- Switched from multiple backup software to Veeam only for simplicity
- Fixed subject format to: Veeam Backup Job "Test-Backup-Job" finished with Success/WARNING/Failed
- Fixed body format to include: Backup job: Test-Backup-Job
- All 3 emails per set use same job name but different dates
- Added realistic VM objects (VM-APP01, VM-DB01, VM-WEB01) with status details
- Each set shows different failure scenarios for testing
- Updated changelog description

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Ivo Oskamp 2026-02-09 14:54:42 +01:00
parent 19ef9dc32a
commit 26848998e1
2 changed files with 156 additions and 70 deletions

View File

@ -309,46 +309,74 @@ def settings_generate_test_emails(status_type):
try: try:
from datetime import datetime, timedelta from datetime import datetime, timedelta
# Fixed test email sets per status type # Fixed test email sets per status type (Veeam only for consistent testing)
# All emails use the same job name "Test-Backup-Job" so they appear as different
# runs of the same job for proper status testing
email_sets = { email_sets = {
"success": [ "success": [
{ {
"from_address": "veeam@test.local", "from_address": "veeam@test.local",
"subject": "Backup job 'Daily VM Backup' completed successfully", "subject": 'Veeam Backup Job "Test-Backup-Job" finished with Success',
"body": """Job name: Daily VM Backup "body": """Backup job: Test-Backup-Job
Status: Success
Session details:
Start time: 2026-02-09 01:00:00 Start time: 2026-02-09 01:00:00
End time: 2026-02-09 02:15:00 End time: 2026-02-09 02:15:00
Total size: 150 GB Total size: 150 GB
Objects processed: 25 Duration: 01:15:00
Processing VM-APP01
Success
Processing VM-DB01
Success
Processing VM-WEB01
Success
All backup operations completed without issues.""", All backup operations completed without issues.""",
}, },
{ {
"from_address": "synology@test.local", "from_address": "veeam@test.local",
"subject": "[Synology] Backup Task SQL Database Backup completed successfully", "subject": 'Veeam Backup Job "Test-Backup-Job" finished with Success',
"body": """Dear Administrator, "body": """Backup job: Test-Backup-Job
Backup task 'SQL Database Backup' has completed successfully. Session details:
Start time: 2026-02-08 01:00:00
End time: 2026-02-08 02:10:00
Total size: 145 GB
Duration: 01:10:00
Task: SQL Database Backup Processing VM-APP01
Status: Success Success
Start: 2026-02-09 02:00:00
Finish: 2026-02-09 02:45:00 Processing VM-DB01
Data transferred: 75 GB Success
Processing VM-WEB01
Success
All backup operations completed without issues.""", All backup operations completed without issues.""",
}, },
{ {
"from_address": "nakivo@test.local", "from_address": "veeam@test.local",
"subject": "Job 'Exchange Mailbox' finished successfully", "subject": 'Veeam Backup Job "Test-Backup-Job" finished with Success',
"body": """NAKIVO Backup & Replication "body": """Backup job: Test-Backup-Job
Job: Exchange Mailbox Session details:
Status: Success Start time: 2026-02-07 01:00:00
Started: 2026-02-09 03:00:00 End time: 2026-02-07 02:20:00
Completed: 2026-02-09 03:30:00 Total size: 152 GB
Size: 50 GB Duration: 01:20:00
Processing VM-APP01
Success
Processing VM-DB01
Success
Processing VM-WEB01
Success
All backup operations completed without issues.""", All backup operations completed without issues.""",
}, },
@ -356,85 +384,143 @@ All backup operations completed without issues.""",
"warning": [ "warning": [
{ {
"from_address": "veeam@test.local", "from_address": "veeam@test.local",
"subject": "Backup job 'Weekly File Server' completed with warnings", "subject": 'Veeam Backup Job "Test-Backup-Job" finished with WARNING',
"body": """Job name: Weekly File Server "body": """Backup job: Test-Backup-Job
Status: Warning
Session details:
Start time: 2026-02-09 01:00:00 Start time: 2026-02-09 01:00:00
End time: 2026-02-09 02:30:00 End time: 2026-02-09 02:30:00
Total size: 200 GB Total size: 148 GB
Objects processed: 35 Duration: 01:30:00
Processing VM-APP01
Success
Processing VM-DB01
Warning
Warning: Low free space on target datastore
Processing VM-WEB01
Success
Backup completed but some files were skipped.""", Backup completed but some files were skipped.""",
}, },
{ {
"from_address": "synology@test.local", "from_address": "veeam@test.local",
"subject": "[Synology] Backup Task Critical Servers completed with warnings", "subject": 'Veeam Backup Job "Test-Backup-Job" finished with WARNING',
"body": """Dear Administrator, "body": """Backup job: Test-Backup-Job
Backup task 'Critical Servers' has completed with warnings. Session details:
Start time: 2026-02-08 01:00:00
End time: 2026-02-08 02:25:00
Total size: 142 GB
Duration: 01:25:00
Task: Critical Servers Processing VM-APP01
Status: Warning Warning
Start: 2026-02-09 02:00:00 Warning: Retry was successful after initial failure
Finish: 2026-02-09 03:00:00
Data transferred: 300 GB
Backup completed but some files were skipped.""", Processing VM-DB01
Success
Processing VM-WEB01
Success
Backup completed with warnings.""",
}, },
{ {
"from_address": "nakivo@test.local", "from_address": "veeam@test.local",
"subject": "Job 'Production Backup' finished with warnings", "subject": 'Veeam Backup Job "Test-Backup-Job" finished with WARNING',
"body": """NAKIVO Backup & Replication "body": """Backup job: Test-Backup-Job
Job: Production Backup Session details:
Status: Warning Start time: 2026-02-07 01:00:00
Started: 2026-02-09 03:00:00 End time: 2026-02-07 02:35:00
Completed: 2026-02-09 04:00:00 Total size: 140 GB
Size: 250 GB Duration: 01:35:00
Some backup objects were skipped.""", Processing VM-APP01
Success
Processing VM-DB01
Success
Processing VM-WEB01
Warning
Warning: Some files were locked and skipped
Backup completed with warnings.""",
}, },
], ],
"error": [ "error": [
{ {
"from_address": "veeam@test.local", "from_address": "veeam@test.local",
"subject": "Backup job 'Development Environment' failed", "subject": 'Veeam Backup Job "Test-Backup-Job" finished with Failed',
"body": """Job name: Development Environment "body": """Backup job: Test-Backup-Job
Status: Failed
Session details:
Start time: 2026-02-09 01:00:00 Start time: 2026-02-09 01:00:00
End time: 2026-02-09 01:15:00 End time: 2026-02-09 01:15:00
Total size: 0 GB Total size: 0 GB
Objects processed: 0 Duration: 00:15:00
Processing VM-APP01
Failed
Error: Cannot create snapshot: VSS error 0x800423f4
Processing VM-DB01
Success
Processing VM-WEB01
Success
Backup failed. Please check the logs for details.""", Backup failed. Please check the logs for details.""",
}, },
{ {
"from_address": "synology@test.local", "from_address": "veeam@test.local",
"subject": "[Synology] Backup Task Archive Job failed", "subject": 'Veeam Backup Job "Test-Backup-Job" finished with Failed',
"body": """Dear Administrator, "body": """Backup job: Test-Backup-Job
Backup task 'Archive Job' has failed. Session details:
Start time: 2026-02-08 01:00:00
End time: 2026-02-08 01:10:00
Total size: 0 GB
Duration: 00:10:00
Task: Archive Job Processing VM-APP01
Status: Failed Success
Start: 2026-02-09 02:00:00
Finish: 2026-02-09 02:05:00
Data transferred: 0 GB
Backup failed. Please check the logs for details.""", Processing VM-DB01
Failed
Error: Disk space exhausted on backup repository
Processing VM-WEB01
Success
Backup failed due to storage issue.""",
}, },
{ {
"from_address": "nakivo@test.local", "from_address": "veeam@test.local",
"subject": "Job 'Critical Servers' finished with errors", "subject": 'Veeam Backup Job "Test-Backup-Job" finished with Failed',
"body": """NAKIVO Backup & Replication "body": """Backup job: Test-Backup-Job
Job: Critical Servers Session details:
Status: Failed Start time: 2026-02-07 01:00:00
Started: 2026-02-09 03:00:00 End time: 2026-02-07 01:05:00
Completed: 2026-02-09 03:10:00 Total size: 0 GB
Size: 0 GB Duration: 00:05:00
Some backup objects failed to process.""", Processing VM-APP01
Success
Processing VM-DB01
Success
Processing VM-WEB01
Failed
Error: Network connection lost to ESXi host
Backup failed. Network issue detected.""",
}, },
], ],
} }

View File

@ -7,7 +7,7 @@ This file documents all changes made to this project via Claude Code.
### Added ### Added
- Added "Cleanup orphaned jobs" maintenance option in Settings → Maintenance to delete jobs without valid customer links and their associated emails/runs permanently from database (useful when customers are removed) - Added "Cleanup orphaned jobs" maintenance option in Settings → Maintenance to delete jobs without valid customer links and their associated emails/runs permanently from database (useful when customers are removed)
- Added "Preview orphaned jobs" button to show detailed list of jobs to be deleted with run/email counts before confirming deletion (verification step for safety) - Added "Preview orphaned jobs" button to show detailed list of jobs to be deleted with run/email counts before confirming deletion (verification step for safety)
- Added "Generate test emails" feature in Settings → Maintenance with three separate buttons to create fixed test email sets (success/warning/error) in inbox for testing parsers and maintenance operations (each set contains exactly 3 emails simulating Veeam, Synology, and NAKIVO backup notifications with consistent data for reproducible testing) - Added "Generate test emails" feature in Settings → Maintenance with three separate buttons to create fixed test email sets (success/warning/error) in inbox for testing parsers and maintenance operations (each set contains exactly 3 Veeam Backup Job emails with the same job name "Test-Backup-Job" and different dates/objects/statuses for reproducible testing and proper status flow testing)
### Changed ### Changed
- Removed customer name from Autotask ticket title to keep titles concise (format changed from "[Backupchecks] Customer - Job Name - Status" to "[Backupchecks] Job Name - Status") - Removed customer name from Autotask ticket title to keep titles concise (format changed from "[Backupchecks] Customer - Job Name - Status" to "[Backupchecks] Job Name - Status")