feat: CI/CD pipeline setup complete - Ansible playbooks updated, secrets configured, workflow ready

This commit is contained in:
2025-10-31 01:39:24 +01:00
parent 55c04e4fd0
commit e26eb2aa12
601 changed files with 44184 additions and 32477 deletions

View File

@@ -4,47 +4,55 @@ declare(strict_types=1);
use App\Framework\Cache\Cache;
use App\Framework\Cache\CacheKey;
use App\Framework\Cache\Driver\FileCache;
use App\Framework\Cache\Driver\InMemoryCache;
use App\Framework\Cache\GeneralCache;
use App\Framework\Serializer\Php\PhpSerializer;
use App\Framework\Cache\Warming\CacheWarmingService;
use App\Framework\Cache\Warming\Strategies\CriticalPathWarmingStrategy;
use App\Framework\Cache\Warming\ScheduledWarmupJob;
use App\Framework\Core\CompiledRoutes;
use App\Framework\Router\CompiledRoutes;
use App\Framework\Config\Environment;
use App\Framework\Logging\Logger;
use App\Framework\Core\ValueObjects\Duration;
describe('Cache Warming Integration', function () {
beforeEach(function () {
// Use real FileCache for integration test
$this->cacheDir = sys_get_temp_dir() . '/cache_warming_test_' . uniqid();
mkdir($this->cacheDir, 0777, true);
$this->cache = new FileCache();
// Use InMemoryCache for tests (no file permissions needed)
$inMemoryCache = new InMemoryCache();
$serializer = new PhpSerializer();
$this->cache = new GeneralCache($inMemoryCache, $serializer);
$this->logger = Mockery::mock(Logger::class);
$this->logger->shouldReceive('info')->andReturnNull();
$this->logger->shouldReceive('debug')->andReturnNull();
$this->logger->shouldReceive('error')->andReturnNull();
$this->compiledRoutes = Mockery::mock(CompiledRoutes::class);
$this->compiledRoutes->shouldReceive('getStaticRoutes')->andReturn([
'/home' => 'HomeController',
'/about' => 'AboutController',
]);
$this->compiledRoutes->shouldReceive('getDynamicRoutes')->andReturn([
'/users/{id}' => 'UserController',
]);
// Use real CompiledRoutes instance for testing
$this->compiledRoutes = new CompiledRoutes(
staticRoutes: [
'GET' => [
'default' => [
'/home' => null, // Route objects not needed for cache warming test
'/about' => null,
]
]
],
dynamicPatterns: [
'GET' => [
'default' => null // CompiledPattern not needed for basic test
]
],
namedRoutes: []
);
$this->environment = Mockery::mock(Environment::class);
// Use real Environment instance for testing
$this->environment = new Environment([
'APP_ENV' => 'testing',
'APP_DEBUG' => 'true',
]);
});
afterEach(function () {
// Cleanup test cache directory
if (is_dir($this->cacheDir)) {
array_map('unlink', glob($this->cacheDir . '/*'));
rmdir($this->cacheDir);
}
Mockery::close();
});
@@ -56,8 +64,8 @@ describe('Cache Warming Integration', function () {
);
$service = new CacheWarmingService(
strategies: [$strategy],
logger: $this->logger
logger: $this->logger,
strategies: [$strategy]
);
// Execute warmup
@@ -65,7 +73,7 @@ describe('Cache Warming Integration', function () {
expect($metrics->totalStrategiesExecuted)->toBe(1);
expect($metrics->totalItemsWarmed)->toBeGreaterThan(0);
expect($metrics->isSuccess())->toBeTrue();
expect($metrics->getOverallSuccessRate())->toBe(1.0); // 100% success
// Verify cache was populated
$routesKey = CacheKey::fromString('routes_static');
@@ -83,8 +91,8 @@ describe('Cache Warming Integration', function () {
);
$service = new CacheWarmingService(
strategies: [$strategy],
logger: $this->logger
logger: $this->logger,
strategies: [$strategy]
);
$scheduledJob = new ScheduledWarmupJob(
@@ -108,8 +116,8 @@ describe('Cache Warming Integration', function () {
);
$service = new CacheWarmingService(
strategies: [$strategy],
logger: $this->logger
logger: $this->logger,
strategies: [$strategy]
);
// Warm only high priority
@@ -127,8 +135,8 @@ describe('Cache Warming Integration', function () {
);
$service = new CacheWarmingService(
strategies: [$strategy],
logger: $this->logger
logger: $this->logger,
strategies: [$strategy]
);
// First warmup
@@ -149,8 +157,8 @@ describe('Cache Warming Integration', function () {
);
$service = new CacheWarmingService(
strategies: [$strategy],
logger: $this->logger
logger: $this->logger,
strategies: [$strategy]
);
$startTime = microtime(true);