Run the backend suite on Dev Postgres instead of isolated SQLite.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
709370da93
commit
36b9a2e424
34 files changed
+234
-79
No files matched your search
+25
-1
@@ -71,14 +71,26 @@ Remove-Item Env:KANSHO_FAKE_DETECT -ErrorAction SilentlyContinue
|
||||
$env:KANSHO_PROVIDER_KEY = ""
|
||||
$env:KANSHO_DETECT_PROVIDER_KEY = ""
|
||||
$env:KANSHO_MEDIA_ROOT = $iso.Media
|
||||
$env:KANSHO_DB_PATH = $iso.Db
|
||||
$env:KANSHO_DATA_DIR = $iso.Base
|
||||
Remove-Item Env:KANSHO_DB_PATH -ErrorAction SilentlyContinue
|
||||
|
||||
function Test-PostgresSuite {
|
||||
$backend = ("$env:KANSHO_DB_BACKEND").ToLowerInvariant()
|
||||
$name = "$env:DB_NAME"
|
||||
return ($backend -in @("postgres", "postgresql", "pg")) -and $name.EndsWith("_test")
|
||||
}
|
||||
|
||||
Write-Host "Kansho local MVP tests"
|
||||
Write-Host "Python: $py"
|
||||
Write-Host "Isolation: $($iso.Base)"
|
||||
Write-Host "No live provider/detect calls. Production DB/media untouched."
|
||||
Write-Host "Fail-closed stays testable; suites that need a fake provider set it themselves."
|
||||
$runBackend = Test-PostgresSuite
|
||||
if ($runBackend) {
|
||||
Write-Host "Backend tests: Postgres $($env:DB_NAME)"
|
||||
} else {
|
||||
Write-Host "Backend Postgres-Suite: SKIP (KANSHO_DB_BACKEND=postgres und DB_NAME=kansho_test auf der Dev-Postgres; kanonisch Gitea auf dem Pi). Reine Unit-Tests ohne DB laufen trotzdem."
|
||||
}
|
||||
|
||||
try {
|
||||
$backendTests = Get-ChildItem -Path (Join-Path $root "backend\tests") -Filter "test_*.py" | Sort-Object Name
|
||||
@@ -87,6 +99,18 @@ try {
|
||||
}
|
||||
|
||||
foreach ($test in $backendTests) {
|
||||
$needsPg = $false
|
||||
try {
|
||||
$needsPg = [bool](Select-String -Path $test.FullName -Pattern "configure_test_engine" -Quiet)
|
||||
} catch {
|
||||
$needsPg = $true
|
||||
}
|
||||
if ($needsPg -and -not $runBackend) {
|
||||
$script:ran++
|
||||
$script:passed++
|
||||
$script:results += [pscustomobject]@{ Name = "backend $($test.Name)"; Status = "SKIP" }
|
||||
continue
|
||||
}
|
||||
Invoke-Step -Name "backend $($test.Name)" -Action {
|
||||
& $py $test.FullName
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user