-
Start the application and dependencies:
# Start PostgreSQL, RabbitMQ, and Redis docker-compose up -d # Start the application npm run start:dev
-
Verify the application is running:
curl http://localhost:3030/health
Step 1: Start an invoice workflow
curl -X POST http://localhost:3030/invoice/workflow/start \
-H "Content-Type: application/json" \
-d '{
"customerId": "customer-123",
"dateFrom": "2024-01-01",
"dateTo": "2024-01-31"
}'Expected Response:
{
"message": "Invoice workflow started",
"taskId": "uuid-here",
"workflowId": null
}Step 2: Check the created task
curl http://localhost:3030/tasks/uuid-hereStep 3: Monitor workflow status
curl http://localhost:3030/invoice/status/customer-123curl -X POST http://localhost:3030/invoice/workflow/scheduled \
-H "Content-Type: application/json" \
-d '{
"customerId": "customer-456",
"scheduledAt": "2024-12-25T10:00:00Z",
"dateFrom": "2024-12-01",
"dateTo": "2024-12-31"
}'curl -X POST http://localhost:3030/invoice/workflow/recurring \
-H "Content-Type: application/json" \
-d '{
"customerId": "customer-789",
"cronExpression": "0 0 * * *",
"dateFrom": "2024-01-01",
"dateTo": "2024-01-31"
}'# Get all tasks for a customer
curl http://localhost:3030/invoice/tasks/customer-123
# Get tasks by status
curl http://localhost:3030/tasks?status=pending
# Get queue status
curl http://localhost:3030/queue-manager/status-
Import the collection:
- Open Postman
- Import
resources/postman/Invoice-Testing.postman_collection.json - Set environment variable
baseUrltohttp://localhost:3030
-
Run the collection:
- Start with "Health Check" to verify the application is running
- Use "Seed Database" to populate test data
- Run "Invoice Workflow - Start" to test basic functionality
- Use "Get Invoice Workflow Status" to monitor progress
npm run test src/app/invoicenpm run test:e2e src/app/invoice/__tests__/invoice.integration.spec.tsnpm run test
npm run test:e2e# View application logs
docker-compose logs -f app
# View database logs
docker-compose logs -f postgres
# View RabbitMQ logs
docker-compose logs -f rabbitmq# Connect to PostgreSQL
docker-compose exec postgres psql -U postgres -d queue_worker
# Check tasks
SELECT * FROM task_entity WHERE payload->>'customerId' = 'customer-123';
# Check task status distribution
SELECT status, COUNT(*) FROM task_entity GROUP BY status;# Access RabbitMQ Management UI
open http://localhost:15672
# Username: guest, Password: guestSolution:
# Check if all services are running
docker-compose ps
# Restart all services
docker-compose down
docker-compose up -dSolution:
# Check database status
docker-compose exec postgres pg_isready -U postgres
# Reset database
docker-compose exec postgres psql -U postgres -c "DROP DATABASE IF EXISTS queue_worker;"
docker-compose exec postgres psql -U postgres -c "CREATE DATABASE queue_worker;"Solution:
# Check worker processes
docker-compose logs app | grep "worker"
# Check queue status
curl http://localhost:3030/queue-manager/status
# Restart the application
docker-compose restart appSolution:
# Check if external services are mocked
curl https://mock-pdf-processor.com/generate
curl https://mock-email-service.com/send
# Update environment variables if needed
export PDF_PROCESSOR_URL=https://mock-pdf-processor.com/generate
export EMAIL_SERVICE_URL=https://mock-email-service.com/send# Run concurrent requests
for i in {1..10}; do
curl -X POST http://localhost:3030/invoice/workflow/start \
-H "Content-Type: application/json" \
-d "{\"customerId\": \"customer-$i\", \"dateFrom\": \"2024-01-01\", \"dateTo\": \"2024-01-31\"}" &
done
wait# Check queue health
curl http://localhost:3030/queue-manager/status
# Monitor database performance
docker-compose exec postgres psql -U postgres -d queue_worker -c "SELECT COUNT(*) FROM task_entity;"# Clear database
curl -X DELETE http://localhost:3030/seeder/clear
# Or reset everything
docker-compose down -v
docker-compose up -ddocker-compose down- Review the comprehensive documentation:
INVOICE_TESTING_DOCUMENTATION.md - Run the integration tests:
src/app/invoice/__tests__/invoice.integration.spec.ts - Use the Postman collection:
resources/postman/Invoice-Testing.postman_collection.json - Explore the codebase: Review the invoice module implementation
- Extend tests: Add more specific test cases for your use cases
If you encounter issues:
- Check the application logs
- Verify all services are running
- Review the troubleshooting section in the main documentation
- Check the test output for specific error messages