Use proper paths for tests

This commit is contained in:
2025-09-09 15:21:19 +02:00
parent 07720e5d65
commit 41d410caf4

View File

@@ -51,7 +51,7 @@ jobs:
VAULT_ADDR: "https://127.0.0.1:8200" VAULT_ADDR: "https://127.0.0.1:8200"
VAULT_SKIP_VERIFY: "true" VAULT_SKIP_VERIFY: "true"
run: | run: |
& ".\scripts\vault-start.ps1" .\script\vault-start.ps1
- name: Setup Vault test data (on Unix) - name: Setup Vault test data (on Unix)
if: matrix.arch != 'windows-amd64' if: matrix.arch != 'windows-amd64'
@@ -72,7 +72,7 @@ jobs:
VAULT_SKIP_VERIFY: "true" VAULT_SKIP_VERIFY: "true"
shell: pwsh shell: pwsh
run: | run: |
& ".\scripts\vault-setup.ps1" .\script\vault-setup.ps1
- name: Vet - name: Vet
run: go vet -v ./... run: go vet -v ./...
@@ -99,58 +99,4 @@ jobs:
if: always() && matrix.arch == 'windows-amd64' if: always() && matrix.arch == 'windows-amd64'
shell: pwsh shell: pwsh
run: | run: |
# Function to display logs .\script\vault-stop.ps1
function Show-VaultLogs {
Write-Output "=== VAULT SERVER STDOUT (last 50 lines) ==="
Get-Content "vault-logs/stdout.log" -ErrorAction SilentlyContinue | Select-Object -Last 50
Write-Output "=== VAULT SERVER STDERR (last 50 lines) ==="
Get-Content "vault-logs/stderr.log" -ErrorAction SilentlyContinue | Select-Object -Last 50
}
# Read PID from file (Gitea alternative to env vars)
$vaultPid = $null
if (Test-Path "vault-pid.txt") {
$vaultPid = Get-Content "vault-pid.txt" -Raw
Write-Output "Found Vault PID: $vaultPid"
}
# Check if previous steps failed
$previousStepFailed = $false
if ("${{ steps.start-vault.outcome }}" -eq "failure") {
$previousStepFailed = $true
Write-Output "Vault startup step failed"
}
# Stop the Vault process if we have a PID
if ($vaultPid -and ($vaultPid -ne '')) {
if ($previousStepFailed) {
Write-Output "Previous step failed, showing Vault logs:"
Show-VaultLogs
}
# Stop the Vault process
try {
Stop-Process -Id $vaultPid -Force -ErrorAction Stop
Write-Output "Stopped Vault process $vaultPid"
} catch {
Write-Warning "Failed to stop process $vaultPid: $($_.Exception.Message)"
}
}
# Clean up any remaining Vault processes
$vaultProcesses = Get-Process -Name "vault" -ErrorAction SilentlyContinue
if ($vaultProcesses) {
Write-Output "Found additional Vault processes, stopping them..."
$vaultProcesses | Stop-Process -Force -ErrorAction SilentlyContinue
}
# Always show logs if we're in a failure state
if ($previousStepFailed -or "${{ job.status }}" -eq "failure") {
Write-Output "Job failed, showing final Vault logs:"
Show-VaultLogs
}
# Cleanup PID file
if (Test-Path "vault-pid.txt") {
Remove-Item "vault-pid.txt" -Force
}