Testing Guide

This guide provides comprehensive testing scenarios for the data pipeline resilience patterns demonstrated in this chapter.

Prerequisites

Ensure you've completed the setup:

./setup-scripts/blog-setup.sh
cd demo-app
bundle exec sidekiq &
bundle exec rails server

Test Scenarios

1. Normal Operation Test

Objective: Verify the pipeline runs successfully end-to-end

Steps:

# Run the complete pipeline
./test_pipeline.rb

Expected Results:

  • All 8 steps complete successfully

  • Parallel extraction steps (orders, users, products) run simultaneously

  • Dependent transformations wait for extractions

  • Final insights include customer and product analytics

  • Notifications sent to configured channels

2. API Testing

Objective: Test the REST API endpoints

3. Parallel Processing Verification

Objective: Confirm independent steps run concurrently

4. Progress Tracking Test

Objective: Verify real-time progress updates work

5. Business Logic Validation

Objective: Verify the generated insights make business sense

6. Error Handling Tests

6.1 Simulate Database Timeout

Expected: Step retries automatically and succeeds on second attempt.

6.2 Simulate CRM API Failure

Expected: CRM extraction retries up to 5 times as configured.

7. Performance Testing

7.1 Large Dataset Test

7.2 Memory Usage Monitoring

8. Event System Testing

Objective: Verify event-driven monitoring works correctly

9. Cache Testing

Objective: Verify caching reduces redundant processing

10. Force Refresh Testing

Objective: Verify force_refresh bypasses cache

Troubleshooting

Common Issues

Pipeline doesn't start:

  • Check Sidekiq is running: ps aux | grep sidekiq

  • Verify Redis is running: redis-cli ping

  • Check Rails logs: tail -f log/development.log

Steps fail with "handler not found":

  • Restart Rails server to reload classes

  • Verify file paths match class names exactly

  • Check YAML configuration syntax

Database connection errors:

  • Verify PostgreSQL is running

  • Check config/database.yml credentials

  • Run rails db:migrate if needed

Memory issues with large datasets:

  • Reduce batch sizes in step handlers

  • Monitor memory usage during processing

  • Consider processing smaller date ranges

Debug Commands

Success Criteria

A successful test run should demonstrate:

Parallel Processing: Extraction steps start simultaneously ✅ Dependency Management: Transform steps wait for prerequisites ✅ Progress Tracking: Real-time updates during processing ✅ Intelligent Retry: Automatic recovery from transient failures ✅ Business Intelligence: Actionable insights generated ✅ Event-Driven Monitoring: Real-time notifications and alerts ✅ Performance: Handles realistic data volumes efficiently ✅ Caching: Reduces redundant processing between runs

Next Steps

After completing these tests:

  1. Customize for your domain - Adapt customer segmentation and product analytics

  2. Add real integrations - Replace mock APIs with actual services

  3. Scale the processing - Test with production-sized datasets

  4. Implement advanced monitoring - Add metrics and alerting

  5. Move to Chapter 3 - Microservices coordination patterns


These patterns form the foundation for enterprise-scale data processing pipelines that handle millions of records reliably.

Last updated