mirror of
https://github.com/phpbb/phpbb.git
synced 2025-10-12 15:34:31 +02:00
Merge pull request #6871 from iMattPro/ticket/17555
[ticket/17555] Optimize windows functional tests
This commit is contained in:
5
.github/phpunit-psql-windows-github.xml
vendored
5
.github/phpunit-psql-windows-github.xml
vendored
@@ -7,7 +7,10 @@
|
|||||||
bootstrap="../tests/bootstrap.php"
|
bootstrap="../tests/bootstrap.php"
|
||||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
|
||||||
cacheDirectory=".phpunit.cache"
|
cacheDirectory=".phpunit.cache"
|
||||||
backupStaticProperties="false">
|
backupStaticProperties="false"
|
||||||
|
timeoutForSmallTests="60"
|
||||||
|
timeoutForMediumTests="300"
|
||||||
|
timeoutForLargeTests="600">
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="phpBB Test Suite">
|
<testsuite name="phpBB Test Suite">
|
||||||
<directory suffix="_test.php">../tests</directory>
|
<directory suffix="_test.php">../tests</directory>
|
||||||
|
64
.github/workflows/tests.yml
vendored
64
.github/workflows/tests.yml
vendored
@@ -544,6 +544,9 @@ jobs:
|
|||||||
GITHUB_WORKSPACE: ${{ github.workspace }}
|
GITHUB_WORKSPACE: ${{ github.workspace }}
|
||||||
TEMP_DIR: ${{ runner.temp }}
|
TEMP_DIR: ${{ runner.temp }}
|
||||||
run: |
|
run: |
|
||||||
|
# Disable Windows Defender real-time monitoring early to improve performance
|
||||||
|
Set-MpPreference -DisableRealtimeMonitoring $true
|
||||||
|
|
||||||
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer, IIS-CommonHttpFeatures, IIS-ManagementConsole, IIS-HttpErrors, IIS-HttpRedirect, IIS-WindowsAuthentication, IIS-StaticContent, IIS-DefaultDocument, IIS-HttpCompressionStatic, IIS-DirectoryBrowsing, IIS-WebServerManagementTools, IIS-CGI -All
|
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer, IIS-CommonHttpFeatures, IIS-ManagementConsole, IIS-HttpErrors, IIS-HttpRedirect, IIS-WindowsAuthentication, IIS-StaticContent, IIS-DefaultDocument, IIS-HttpCompressionStatic, IIS-DirectoryBrowsing, IIS-WebServerManagementTools, IIS-CGI -All
|
||||||
Set-Service wuauserv -StartupType Manual
|
Set-Service wuauserv -StartupType Manual
|
||||||
(Get-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config).replace("<configuration>", "<configuration>`n`t<system.web>`n`t`t<customErrors mode=`"Off`"/>`n`t</system.web>") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config
|
(Get-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config).replace("<configuration>", "<configuration>`n`t<system.web>`n`t`t<customErrors mode=`"Off`"/>`n`t</system.web>") | Set-Content ${env:GITHUB_WORKSPACE}\phpBB\web.config
|
||||||
@@ -564,16 +567,38 @@ jobs:
|
|||||||
New-WebHandler -Name "PHP-FastCGI" -Path "*.php" -Modules FastCgiModule -ScriptProcessor "C:\tools\php\php-cgi.exe" -Verb '*' -ResourceType Either
|
New-WebHandler -Name "PHP-FastCGI" -Path "*.php" -Modules FastCgiModule -ScriptProcessor "C:\tools\php\php-cgi.exe" -Verb '*' -ResourceType Either
|
||||||
iisreset
|
iisreset
|
||||||
NET START W3SVC
|
NET START W3SVC
|
||||||
mkdir "${env:GITHUB_WORKSPACE}\phpBB\cache\test"
|
|
||||||
mkdir "${env:GITHUB_WORKSPACE}\phpBB\cache\installer"
|
# Wait for IIS to be ready and test connectivity
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\cache" /grant Users:F /T
|
Start-Sleep -Seconds 10
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\files" /grant Users:F /T
|
try {
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\store" /grant Users:F /T
|
$response = Invoke-WebRequest -Uri "http://phpbb.test/" -UseBasicParsing -TimeoutSec 30
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\ext" /grant Users:F /T
|
Write-Host "Web server is responding: $($response.StatusCode)"
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\vendor-ext" /grant Users:F /T
|
} catch {
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\composer-ext.json" /grant Users:F /T
|
Write-Host "Web server test failed: $_"
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\composer-ext.lock" /grant Users:F /T
|
}
|
||||||
icacls "${env:GITHUB_WORKSPACE}\phpBB\images\avatars\upload" /grant Users:F /T
|
|
||||||
|
# Create directories and set permissions more efficiently
|
||||||
|
$dirs = @("cache\test", "cache\installer")
|
||||||
|
foreach ($dir in $dirs) {
|
||||||
|
New-Item -Path "${env:GITHUB_WORKSPACE}\phpBB\$dir" -ItemType Directory -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set permissions in batch for better performance
|
||||||
|
$paths = @("cache", "files", "store", "ext", "vendor-ext", "images\avatars\upload")
|
||||||
|
foreach ($path in $paths) {
|
||||||
|
if (Test-Path "${env:GITHUB_WORKSPACE}\phpBB\$path") {
|
||||||
|
icacls "${env:GITHUB_WORKSPACE}\phpBB\$path" /grant Users:F /T /Q
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set permissions for specific files
|
||||||
|
$files = @("composer-ext.json", "composer-ext.lock")
|
||||||
|
foreach ($file in $files) {
|
||||||
|
if (Test-Path "${env:GITHUB_WORKSPACE}\phpBB\$file") {
|
||||||
|
icacls "${env:GITHUB_WORKSPACE}\phpBB\$file" /grant Users:F /Q
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
|
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
|
||||||
$acl = Get-ACL "${env:TEMP_DIR}"
|
$acl = Get-ACL "${env:TEMP_DIR}"
|
||||||
$acl.AddAccessRule($accessRule)
|
$acl.AddAccessRule($accessRule)
|
||||||
@@ -586,7 +611,7 @@ jobs:
|
|||||||
$postgreSqlSvc = Get-Service "postgresql*"
|
$postgreSqlSvc = Get-Service "postgresql*"
|
||||||
Set-Service $postgreSqlSvc.Name -StartupType manual
|
Set-Service $postgreSqlSvc.Name -StartupType manual
|
||||||
$runningStatus = [System.ServiceProcess.ServiceControllerStatus]::Running
|
$runningStatus = [System.ServiceProcess.ServiceControllerStatus]::Running
|
||||||
$maxStartTimeout = New-TimeSpan -Seconds 30
|
$maxStartTimeout = New-TimeSpan -Seconds 120
|
||||||
try {
|
try {
|
||||||
$postgreSqlSvc.Start()
|
$postgreSqlSvc.Start()
|
||||||
$postgreSqlSvc.WaitForStatus($runningStatus, $maxStartTimeout)
|
$postgreSqlSvc.WaitForStatus($runningStatus, $maxStartTimeout)
|
||||||
@@ -595,12 +620,17 @@ jobs:
|
|||||||
}
|
}
|
||||||
[System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";${env:PGBIN}")
|
[System.Environment]::SetEnvironmentVariable('PATH',$Env:PATH+";${env:PGBIN}")
|
||||||
$env:PGPASSWORD = 'root'
|
$env:PGPASSWORD = 'root'
|
||||||
psql -c 'ALTER SYSTEM SET hot_standby = on;' -U postgres
|
|
||||||
psql -c 'ALTER SYSTEM SET wal_level = minimal;' -U postgres
|
# Optimize PostgreSQL for testing performance
|
||||||
|
psql -c "ALTER SYSTEM SET fsync = off;" -U postgres
|
||||||
|
psql -c "ALTER SYSTEM SET synchronous_commit = off;" -U postgres
|
||||||
|
psql -c "ALTER SYSTEM SET checkpoint_completion_target = 0.9;" -U postgres
|
||||||
|
psql -c "ALTER SYSTEM SET wal_buffers = '16MB';" -U postgres
|
||||||
|
psql -c "ALTER SYSTEM SET shared_buffers = '128MB';" -U postgres
|
||||||
psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres
|
psql -c 'DROP DATABASE IF EXISTS phpbb_tests;' -U postgres
|
||||||
psql -c 'create database phpbb_tests;' -U postgres
|
psql -c 'create database phpbb_tests;' -U postgres
|
||||||
|
|
||||||
Set-MpPreference -ExclusionPath "${env:PGDATA}" # Exclude PGDATA directory from Windows Defender
|
Set-MpPreference -ExclusionPath "${env:PGDATA}" # Exclude PGDATA directory from Windows Defender
|
||||||
Set-MpPreference -DisableRealtimeMonitoring $true
|
|
||||||
|
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@@ -615,5 +645,11 @@ jobs:
|
|||||||
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --exclude-group functional,slow
|
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --exclude-group functional,slow
|
||||||
- name: Run functional tests
|
- name: Run functional tests
|
||||||
if: ${{ matrix.type == 'functional' }}
|
if: ${{ matrix.type == 'functional' }}
|
||||||
|
timeout-minutes: 45
|
||||||
|
env:
|
||||||
|
PHPBB_FUNCTIONAL_TIMEOUT: 30
|
||||||
|
SYMFONY_DEPRECATIONS_HELPER: disabled
|
||||||
|
PHPBB_TEST_REDIS_HOST: ''
|
||||||
|
PHPBB_TEST_MEMCACHED_HOST: ''
|
||||||
run: |
|
run: |
|
||||||
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --group functional
|
phpBB/vendor/bin/phpunit --configuration .github/phpunit-psql-windows-github.xml --display-all-issues --stop-on-error --group functional
|
||||||
|
@@ -129,11 +129,17 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||||||
$this->bootstrap();
|
$this->bootstrap();
|
||||||
|
|
||||||
self::$cookieJar = new CookieJar;
|
self::$cookieJar = new CookieJar;
|
||||||
// Force native client on windows platform
|
// Optimize HTTP client for Windows platform
|
||||||
self::$http_client = strtolower(substr(PHP_OS, 0, 3)) === 'win' ? new NativeHttpClient() : HttpClient::create();
|
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
|
||||||
self::$http_client->withOptions([
|
self::$http_client = new NativeHttpClient([
|
||||||
|
'timeout' => 30,
|
||||||
|
'max_duration' => 60,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
self::$http_client = HttpClient::create([
|
||||||
'timeout' => 60,
|
'timeout' => 60,
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
self::$client = new HttpBrowser(self::$http_client, null, self::$cookieJar);
|
self::$client = new HttpBrowser(self::$http_client, null, self::$cookieJar);
|
||||||
|
|
||||||
// Clear the language array so that things
|
// Clear the language array so that things
|
||||||
|
Reference in New Issue
Block a user