CI test
CI / php (push) Successful in 1m0s
CI / Tier 2 — Magento + nginx + holesail (push) Failing after 6m33s

This commit is contained in:
2026-04-01 21:00:06 -05:00
parent 5537aa670f
commit a744c3bc9f
21 changed files with 884 additions and 13 deletions
@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);
namespace MageSail\Magesail\Test\Integration;
use MageSail\Magesail\Model\NginxGlobalMapManager;
use Magento\Framework\App\Cache\Type\Config as ConfigCacheType;
use Magento\Framework\App\Cache\TypeListInterface;
use Magento\Framework\App\Config\ReinitableConfigInterface;
use Magento\Framework\App\Config\Storage\WriterInterface;
use Magento\TestFramework\Helper\Bootstrap;
use PHPUnit\Framework\TestCase;
/**
* Runs real `/usr/sbin/nginx -t` against a minimal include (see NginxGlobalMapManager).
*
* @group magesail_integration
* @group magesail_nginx
* @magentoDbIsolation enabled
* @magentoAppArea adminhtml
*/
class NginxGlobalMapRealBinaryTest extends TestCase
{
private function minimalMapBody(): string
{
return <<<'MAP'
map $http_host $MAGE_RUN_CODE {
default '';
}
map $http_host $MAGE_RUN_TYPE {
default '';
}
MAP;
}
private function flushConfig(): void
{
$om = Bootstrap::getObjectManager();
$om->get(TypeListInterface::class)->cleanType(ConfigCacheType::TYPE_IDENTIFIER);
$om->get(ReinitableConfigInterface::class)->reinit();
}
public function testValidateNginxConfigUsesRealNginxBinary(): void
{
$mapPath = sys_get_temp_dir() . '/magesail_ci_nginx_map_' . bin2hex(random_bytes(4)) . '.map';
self::assertNotFalse(file_put_contents($mapPath, $this->minimalMapBody()));
try {
$om = Bootstrap::getObjectManager();
/** @var WriterInterface $writer */
$writer = $om->get(WriterInterface::class);
$writer->save('magesail/nginx/global_map_path', $mapPath);
$writer->save('magesail/nginx/nginx_binary', '/usr/sbin/nginx');
$this->flushConfig();
/** @var NginxGlobalMapManager $manager */
$manager = $om->create(NginxGlobalMapManager::class);
$result = $manager->validateNginxConfig();
self::assertTrue($result['valid'], 'nginx -t should pass: ' . ($result['error'] ?? $result['output'] ?? ''));
} finally {
@unlink($mapPath);
}
}
}