Treasury & Bank Transfer Management System — سامانه مدیریت خزانه‌داری و حواله‌های بانکی

test(windows): allow bounded four-minute NSIS install and report elapsed time

davoodmehraban89 committed Oct 17, 2026 at 01:50 UTC 9302ea2e007df3cbd9280794fbb42d222927e6c2
1 file changed +9 -3
scripts/windows-vm-treasury-install-smoke.ps1
+9 -3
@@ -4,7 +4,7 @@ $evidenceDir=Join-Path $env:RUNNER_TEMP 'treasuryflow-vm-evidence'
4 New-Item -ItemType Directory $evidenceDir -Force | Out-Null
5 $report=[ordered]@{installerPresent=$false;installerSha256=$null;silentInstall='NOT_RUN';
6 installedExecutableFound=$false;installedProcessLaunched=$false;httpReady=$false;
7 - bankAdapterDisabled=$false;homeHtmlLoaded=$false;outcome='NOT_RUN'}
7 + bankAdapterDisabled=$false;homeHtmlLoaded=$false;installSeconds=0;installTimeoutSeconds=240;installerProcessExited=$false;outcome='NOT_RUN'}
8 $target=Join-Path $env:RUNNER_TEMP 'TreasuryFlow-VM-Installed'
9 $p=$null
10 try {
@@ -15,13 +15,19 @@ try {
15 $report.installerSha256=(Get-FileHash $setup -Algorithm SHA256).Hash
16 if(Test-Path $target){throw 'INSTALL_TEST_DIRECTORY_ALREADY_EXISTS'}
17 # NSIS silent switch; /D=<path> must be the last argument.
18 + $stopwatch=[System.Diagnostics.Stopwatch]::StartNew()
19 $setupProcess=Start-Process -FilePath $setup -ArgumentList @('/S',('/D='+$target)) -PassThru
20 # Wait only for the NSIS installer PID, not the entire inherited process tree.
21 # This follows Factor-easyPro's native Windows VM lab and has a hard timeout.
21 - if(!$setupProcess.WaitForExit(90000)){
22 + if(!$setupProcess.WaitForExit(240000)){
23 + $report.installSeconds=[math]::Round($stopwatch.Elapsed.TotalSeconds,1)
24 + $report.installedExeSeenAtTimeout=@(Get-ChildItem -LiteralPath $target -Recurse -File -Filter 'TreasuryFlow.exe' -ErrorAction SilentlyContinue).Count -gt 0
25 try{$setupProcess.Kill()}catch{}
23 - throw 'NSIS_INSTALL_TIMEOUT'
26 + throw 'NSIS_INSTALL_TIMEOUT_AFTER_240_SECONDS'
27 }
28 + $stopwatch.Stop()
29 + $report.installSeconds=[math]::Round($stopwatch.Elapsed.TotalSeconds,1)
30 + $report.installerProcessExited=$true
31 if($setupProcess.ExitCode -ne 0){throw ('NSIS_INSTALLER_NONZERO_EXIT_'+$setupProcess.ExitCode)}
32 if(!(Test-Path $target)){throw 'NSIS_INSTALL_LOCATION_NOT_CREATED'}
33 $report.silentInstall='PASS'