Files
michaelschiemer/tests/debug/test-queue-system.php
Michael Schiemer fc3d7e6357 feat(Production): Complete production deployment infrastructure
- Add comprehensive health check system with multiple endpoints
- Add Prometheus metrics endpoint
- Add production logging configurations (5 strategies)
- Add complete deployment documentation suite:
  * QUICKSTART.md - 30-minute deployment guide
  * DEPLOYMENT_CHECKLIST.md - Printable verification checklist
  * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle
  * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference
  * production-logging.md - Logging configuration guide
  * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation
  * README.md - Navigation hub
  * DEPLOYMENT_SUMMARY.md - Executive summary
- Add deployment scripts and automation
- Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment
- Update README with production-ready features

All production infrastructure is now complete and ready for deployment.
2025-10-25 19:18:37 +02:00

122 lines
4.4 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../../vendor/autoload.php';
use App\Framework\Core\AppBootstrapper;
use App\Framework\DateTime\SystemClock;
use App\Framework\DateTime\SystemHighResolutionClock;
use App\Framework\Performance\EnhancedPerformanceCollector;
use App\Framework\Performance\MemoryMonitor;
use App\Framework\Queue\Interfaces\DistributedLockInterface;
use App\Framework\Queue\Services\FailoverRecoveryService;
use App\Framework\Queue\Services\JobDistributionService;
use App\Framework\Queue\Services\WorkerHealthCheckService;
use App\Framework\Queue\Services\WorkerRegistry;
use App\Framework\Queue\ValueObjects\QueueName;
use App\Framework\Queue\ValueObjects\WorkerId;
echo "🧪 Testing Queue System Initialization...\n";
try {
// Bootstrap application using the same pattern as console.php
echo "1. Bootstrapping application...\n";
// Use working directory
$basePath = '/var/www/html';
chdir($basePath);
// Create dependencies for enhanced performance collector
$clock = new SystemClock();
$highResClock = new SystemHighResolutionClock();
$memoryMonitor = new MemoryMonitor();
$collector = new EnhancedPerformanceCollector($clock, $highResClock, $memoryMonitor, enabled: false);
$bootstrapper = new AppBootstrapper($basePath, $collector, $memoryMonitor);
$app = $bootstrapper->bootstrapConsole();
$container = $app->getContainer();
echo " ✅ Application bootstrapped\n";
// Test DistributedLockInterface registration
echo "\n2. Testing DistributedLockInterface registration...\n";
try {
$distributedLock = $container->get(DistributedLockInterface::class);
echo " ✅ DistributedLockInterface: " . get_class($distributedLock) . "\n";
} catch (Exception $e) {
echo " ❌ DistributedLockInterface not registered: " . $e->getMessage() . "\n";
}
// Test WorkerRegistry registration
echo "\n3. Testing WorkerRegistry registration...\n";
try {
$workerRegistry = $container->get(WorkerRegistry::class);
echo " ✅ WorkerRegistry: " . get_class($workerRegistry) . "\n";
} catch (Exception $e) {
echo " ❌ WorkerRegistry not registered: " . $e->getMessage() . "\n";
}
// Test JobDistributionService registration
echo "\n4. Testing JobDistributionService registration...\n";
try {
$jobDistribution = $container->get(JobDistributionService::class);
echo " ✅ JobDistributionService: " . get_class($jobDistribution) . "\n";
} catch (Exception $e) {
echo " ❌ JobDistributionService not registered: " . $e->getMessage() . "\n";
}
// Test WorkerHealthCheckService registration
echo "\n5. Testing WorkerHealthCheckService registration...\n";
try {
$healthCheck = $container->get(WorkerHealthCheckService::class);
echo " ✅ WorkerHealthCheckService: " . get_class($healthCheck) . "\n";
} catch (Exception $e) {
echo " ❌ WorkerHealthCheckService not registered: " . $e->getMessage() . "\n";
}
// Test FailoverRecoveryService registration
echo "\n6. Testing FailoverRecoveryService registration...\n";
try {
$failoverRecovery = $container->get(FailoverRecoveryService::class);
echo " ✅ FailoverRecoveryService: " . get_class($failoverRecovery) . "\n";
} catch (Exception $e) {
echo " ❌ FailoverRecoveryService not registered: " . $e->getMessage() . "\n";
}
// Test basic functionality
if (isset($workerRegistry)) {
echo "\n7. Testing basic WorkerRegistry functionality...\n";
try {
$workers = $workerRegistry->getActiveWorkers();
echo " ✅ Found " . count($workers) . " active workers\n";
} catch (Exception $e) {
echo " ❌ WorkerRegistry error: " . $e->getMessage() . "\n";
}
}
// Test Value Objects
echo "\n8. Testing Value Objects...\n";
try {
$workerId = WorkerId::generate();
echo " ✅ WorkerId: " . $workerId->toString() . "\n";
$queueName = QueueName::fromString('test');
echo " ✅ QueueName: " . $queueName->toString() . "\n";
} catch (Exception $e) {
echo " ❌ Value Object error: " . $e->getMessage() . "\n";
}
echo "\n🎉 Queue System test completed!\n";
} catch (Exception $e) {
echo "❌ Fatal error during testing: " . $e->getMessage() . "\n";
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
}