feat: intégration TikTak #197-200 + scoped tokens, webhooks filtrés, listes mtime/size ; fix e2e-server BUG-112
This commit is contained in:
+29
-8
@@ -120,12 +120,33 @@ switch ($Command) {
|
||||
$env:VAULT_1_PATH = (Resolve-Path -LiteralPath "test_vault").Path
|
||||
$env:DIR_1_NAME = "TestDir"
|
||||
$env:DIR_1_PATH = (Resolve-Path -LiteralPath "test_dir").Path
|
||||
$server = Start-Process -FilePath $Python `
|
||||
-ArgumentList "-m", "uvicorn", "backend.main:app", "--host", "127.0.0.1", "--port", $Port `
|
||||
-RedirectStandardOutput $OutLog -RedirectStandardError $ErrLog `
|
||||
-PassThru -WindowStyle Hidden
|
||||
$server.Id | Set-Content -LiteralPath $PidFile
|
||||
Write-Host " PID $($server.Id) (logs : $OutLog / $ErrLog)."
|
||||
# BUG-112 : `Start-Process` laissait uvicorn hériter des handles stdout/stderr
|
||||
# du parent pwsh — avec un pipe (`... | head -n 20`), l'EOF n'arrivait jamais
|
||||
# et la commande semblait bloquée alors que le serveur était déjà prêt.
|
||||
# `Win32_Process.Create` (WMI) lance uvicorn dans un processus détaché qui
|
||||
# n'hérite d'aucun handle : le pipe se ferme quand le script se termine.
|
||||
# Le processus WMI n'hérite PAS de l'environnement du parent → les variables
|
||||
# OBSIGATE_* sont passées explicitement via `set "NOM=valeur"` dans cmd /c.
|
||||
$PythonAbs = (Resolve-Path -LiteralPath $Python).Path
|
||||
$OutLogAbs = Join-Path $Root "data\e2e-server.log"
|
||||
$ErrLogAbs = Join-Path $Root "data\e2e-server.err.log"
|
||||
$CmdLine = "cmd /c set `"OBSIGATE_AUTH_ENABLED=false`"&&" +
|
||||
"set `"VAULT_1_NAME=$env:VAULT_1_NAME`"&&" +
|
||||
"set `"VAULT_1_PATH=$env:VAULT_1_PATH`"&&" +
|
||||
"set `"DIR_1_NAME=$env:DIR_1_NAME`"&&" +
|
||||
"set `"DIR_1_PATH=$env:DIR_1_PATH`"&&" +
|
||||
"`"$PythonAbs`" -m uvicorn backend.main:app --host 127.0.0.1 --port $Port > `"$OutLogAbs`" 2> `"$ErrLogAbs`""
|
||||
$created = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{
|
||||
CommandLine = $CmdLine
|
||||
CurrentDirectory = $Root
|
||||
}
|
||||
if ($created.ReturnValue -ne 0) {
|
||||
Write-Host "[ERR] Échec du lancement uvicorn (code WMI $($created.ReturnValue))."
|
||||
exit 1
|
||||
}
|
||||
$serverId = [int]$created.ProcessId
|
||||
$serverId | Set-Content -LiteralPath $PidFile
|
||||
Write-Host " PID $serverId (logs : $OutLog / $ErrLog)."
|
||||
|
||||
Write-Host "[4/4] Attente du health check (30 s max)..."
|
||||
$ready = $false
|
||||
@@ -135,8 +156,8 @@ switch ($Command) {
|
||||
$ready = $true
|
||||
break
|
||||
} catch {
|
||||
if ($server.HasExited) {
|
||||
Write-Host "[ERR] Le serveur a quitté (code $($server.ExitCode)). Fin du log :"
|
||||
if (-not (Get-Process -Id $serverId -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "[ERR] Le serveur a quitté. Fin du log :"
|
||||
Get-Content -LiteralPath $ErrLog -Tail 15 -ErrorAction SilentlyContinue
|
||||
exit 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user