32 lines
1.6 KiB
PowerShell
32 lines
1.6 KiB
PowerShell
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string] $RedisConnection
|
|
)
|
|
|
|
$cacheRepoRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
|
|
$cachePreviousConnection = $env:REDIS_TEST_CONNECTION
|
|
$cacheValidationRoot = Join-Path $cacheRepoRoot 'artifacts/cache-validation'
|
|
New-Item -ItemType Directory -Path $cacheValidationRoot -Force | Out-Null
|
|
$env:REDIS_TEST_CONNECTION = $RedisConnection
|
|
|
|
try {
|
|
Push-Location $cacheRepoRoot
|
|
dotnet test test/unit/Elsa.Caching.UnitTests/Elsa.Caching.UnitTests.csproj -m:1 -p:BuildInParallel=false -p:GeneratePackageOnBuild=false
|
|
if ($LASTEXITCODE -ne 0) { throw 'Workflow cache tests failed.' }
|
|
dotnet build test/integration/Elsa.Caching.ProcessTests/Elsa.Caching.ProcessTests.csproj -m:1 -p:BuildInParallel=false -p:GeneratePackageOnBuild=false
|
|
if ($LASTEXITCODE -ne 0) { throw 'Workflow cache process test build failed.' }
|
|
|
|
$cacheTestRun = [Guid]::NewGuid().ToString('N')
|
|
$cacheDatabasePath = Join-Path $cacheValidationRoot ($cacheTestRun + '.db')
|
|
$cacheKeyPrefix = 'workflow-process-tests:' + $cacheTestRun + ':'
|
|
$cacheProcessProgram = Join-Path $cacheRepoRoot 'test/integration/Elsa.Caching.ProcessTests/bin/Debug/net9.0/Elsa.Caching.ProcessTests.dll'
|
|
foreach ($cacheProcessMode in @('write', 'read', 'invalidate', 'read-updated', 'pending', 'bypass')) {
|
|
dotnet $cacheProcessProgram $cacheDatabasePath $cacheKeyPrefix $cacheProcessMode
|
|
if ($LASTEXITCODE -ne 0) { throw "Independent process test failed: $cacheProcessMode" }
|
|
}
|
|
}
|
|
finally {
|
|
Pop-Location
|
|
$env:REDIS_TEST_CONNECTION = $cachePreviousConnection
|
|
}
|