configure Redis cache and distributed locks

This commit is contained in:
Behzad Alizadeh
2026-10-10 16:50:37 +03:30
parent 3f75fec42b
commit 2676bf6ffd
155 changed files with 1784 additions and 229 deletions
+31
View File
@@ -0,0 +1,31 @@
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
}