Files
nfoguard/TESTING.md
T
sbcrumb 01cd31505a Complete v0.6.0 documentation update and review
📚 Documentation Updates:
• Updated CHANGELOG.md with comprehensive v0.6.0 feature list
• Enhanced README.md with new TV processing endpoints and examples
• Updated SETUP.md with required Sonarr API key configuration
• Enhanced TESTING.md with v0.6.0 TV testing procedures
• Updated .env templates with proper Sonarr requirements

🔧 Configuration Updates:
• Mark SONARR_API_KEY as REQUIRED for v0.6.0+ Enhanced TV NFOs
• Updated version examples from 0.5.1 to 0.6.0
• Added JSON response examples for new TV endpoints
• Clarified URL-safe vs URL-encoded endpoint options

📋 Complete File Review:
• Verified all Python imports are consistent across modules
• Confirmed all typing imports (Dict, Any, List, Optional) are present
• Validated configuration templates match actual requirements
• Added comprehensive testing procedures for TV enhancements

 Ready for Production:
• All endpoints documented with examples
• Configuration requirements clearly specified
• Testing procedures comprehensive for troubleshooting
• Backward compatibility maintained throughout
2025-09-11 10:10:05 -04:00

4.7 KiB

NFOGuard Testing Guide

🧪 Test Scripts Overview

NFOGuard includes 3 specialized testing scripts to validate different parts of the workflow. These are designed to be run via webhooks or manual API calls, not directly on the command line.

1. test_bulk_update.py - Database Connection Validator

Purpose: Tests that the bulk update system can connect to databases without modifying any data.

What it tests:

  • Radarr database connection
  • NFOGuard database connection
  • Query execution (reads first 5 movies)
  • Import detection logic

When to use: Before running the full bulk update to ensure everything is configured correctly.

How to run:

# Via webhook/API inside container
curl -X POST "http://nfoguard:8080/test/bulk-update"

# Or manually inside container
python3 test_bulk_update.py

2. test_movie_scan.py - Directory Structure Validator

Purpose: Tests the movie directory scanning logic to ensure movies will be found.

What it tests:

  • Path configuration validation
  • IMDb ID parsing from directory names
  • Movie discovery logic
  • Directory structure understanding

When to use: When manual scans report "0 movies found" to debug path issues.

Sample output:

🔍 Testing Movie Directory Scanning
✅ '/media/Movies/movies' -> Found 150 movies with IMDb IDs
✅ 'The Dark Knight [imdb-tt0468569] (2008)' -> tt0468569
❌ 'Invalid Movie (2020)' -> No IMDb ID found

3. test_end_to_end.py - Complete Workflow Validator

Purpose: Tests the entire NFOGuard workflow from database queries to NFO creation.

What it tests:

  • Server health and connectivity
  • Database performance (your July 2025 date test)
  • Manual scan trigger
  • Batch processing status
  • Statistics endpoints

When to use: After deployment to verify the complete system works end-to-end.

How to run:

# Via webhook inside container
curl -X POST "http://nfoguard:8080/test/end-to-end"

🚀 Testing Workflow for Docker Deployment

Step 1: Deploy with Environment Variables

# Copy your environment template
cp .env.example .env
# Edit .env with your actual database password
nano .env

# Deploy
docker-compose up -d

Step 2: Validate Database Connections

# Test database connectivity
curl -X POST "http://localhost:8080/test/bulk-update"

# Should show:
# ✅ Radarr database connection successful
# ✅ NFOGuard database connection successful

Step 3: Test Movie Discovery

# Test that movies will be found
curl -X POST "http://localhost:8080/test/movie-scan"

# Should show paths and sample movies found

Step 4: Run Full End-to-End Test

# Complete workflow test
curl -X POST "http://localhost:8080/test/end-to-end"

# Should show all systems operational

Step 5: Production Testing

# Test database performance (your working July date)
curl "http://localhost:8080/debug/movie/tt1674782"

# Should return: 2025-07-08T03:30:04+00:00

# Run manual scan
curl -X POST "http://localhost:8080/manual/scan?scan_type=movies"

# Run bulk update
curl -X POST "http://localhost:8080/bulk/update"

Step 6: Test Enhanced TV Processing (v0.6.0+)

# Test Sonarr API integration
curl "http://localhost:8080/health"
# Check that Sonarr connection shows up

# Test single season processing (URL-safe)
curl -X POST "http://localhost:8080/tv/scan-season" \
  -H "Content-Type: application/json" \
  -d '{
    "series_path": "/media/TV/tv/Your Show [imdb-tt1234567]",
    "season_name": "Season 01"
  }'

# Test single episode processing (URL-safe)
curl -X POST "http://localhost:8080/tv/scan-episode" \
  -H "Content-Type: application/json" \
  -d '{
    "series_path": "/media/TV/tv/Your Show [imdb-tt1234567]",
    "season_name": "Season 01",
    "episode_name": "S01E01.mkv"
  }'

# Verify enhanced NFO was created with metadata
find /media/TV/tv -name "S01E*.nfo" | head -1 | xargs cat
# Should show: <title>, <plot>, <rating>, <runtime>, timestamps

🛠 Why These Tests Are Needed

  1. Docker Environment Isolation: Tests run in the same environment as the production app
  2. Database-Only Validation: Ensures the optimized database queries work correctly
  3. Path Configuration: Validates that your specific directory structure is properly configured
  4. Webhook Integration: Tests run via HTTP calls, same as Radarr webhooks
  5. CI/CD Integration: Can be automated in deployment pipelines

🔍 Troubleshooting with Tests

"0 movies processed" → Run test_movie_scan.py to check path configuration Database errors → Run test_bulk_update.py to validate connections Workflow issues → Run test_end_to_end.py for comprehensive diagnosis

These tests are designed to catch issues before they impact your media processing workflow.