57 lines
1.5 KiB
PowerShell
57 lines
1.5 KiB
PowerShell
param(
|
|
[int]$AntiFlakeCount = 20,
|
|
[int]$TargetedCount = 50,
|
|
[string]$TargetedTimeout = "60s",
|
|
[switch]$SkipRace
|
|
)
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")
|
|
$agentDir = Join-Path $repoRoot "agents\rap-node-agent"
|
|
|
|
function Invoke-Go {
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string[]]$Args
|
|
)
|
|
& go @Args
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "go $($Args -join ' ') failed with exit code $LASTEXITCODE"
|
|
}
|
|
}
|
|
|
|
Write-Host "[vpnruntime] repo root: $repoRoot"
|
|
Write-Host "[vpnruntime] agent dir: $agentDir"
|
|
|
|
Push-Location $agentDir
|
|
try {
|
|
Write-Host "[vpnruntime] go test ./..."
|
|
Invoke-Go -Args @("test", "./...")
|
|
|
|
Write-Host "[vpnruntime] go test ./internal/vpnruntime -count=$AntiFlakeCount"
|
|
Invoke-Go -Args @("test", "./internal/vpnruntime", "-count=$AntiFlakeCount")
|
|
|
|
Write-Host "[vpnruntime] targeted anti-flake"
|
|
Invoke-Go -Args @(
|
|
"test",
|
|
"./internal/vpnruntime",
|
|
"-run", "TestFabricClientPacketIngressParallelFlowWindowDoesNotBlockIndependentChannel",
|
|
"-count=$TargetedCount",
|
|
"-timeout=$TargetedTimeout"
|
|
)
|
|
|
|
if (-not $SkipRace) {
|
|
Write-Host "[vpnruntime] race check"
|
|
Invoke-Go -Args @("test", "-race", "./internal/vpnruntime")
|
|
} else {
|
|
Write-Host "[vpnruntime] race check skipped"
|
|
}
|
|
|
|
Write-Host "[vpnruntime] all guards passed"
|
|
}
|
|
finally {
|
|
Pop-Location
|
|
}
|