Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion test/IntegrationTest/Integration.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,39 @@ if ($env:SENTRY_TEST_PLATFORM -ne "WebGL") {
$eventId = Get-EventIds -AppOutput $script:runResult.Output -ExpectedCount 1
if ($eventId) {
Write-Host "::group::Getting event content"
$script:runEvent = Get-SentryTestEvent -TagName "test.crash_id" -TagValue "$eventId" -TimeoutSeconds 300

# Race two lookups: the project events endpoint resolves as soon as the event is
# ingested + tag-indexed, while the issues endpoint also requires issue grouping.
# We poll the events endpoint here and hand off to Get-SentryTestEvent for the
# full fetch + entry flattening; if the events endpoint never returns a hit we
# fall back to the original tag-via-issues path so the failure mode is unchanged.
# Poll every 5 s to stay well under Sentry's API rate limit on this endpoint.
$pollBudgetSeconds = 300
$pollStart = Get-Date
$pollEnd = $pollStart.AddSeconds($pollBudgetSeconds)
$resolvedEventId = $null
do {
try {
$hits = Get-SentryEventsByTag -TagName "test.crash_id" -TagValue "$eventId" -Limit 1
if ($hits -and @($hits).Count -ge 1) {
$resolvedEventId = $hits[0].eventID
break
}
} catch {
Write-Debug "Get-SentryEventsByTag poll failed: $($_.Exception.Message)"
}
Start-Sleep -Seconds 5
} while ((Get-Date) -lt $pollEnd)

if ($resolvedEventId) {
Write-Host "Resolved crash event $resolvedEventId via project events endpoint"
$remaining = [Math]::Max(30, [int]($pollEnd - (Get-Date)).TotalSeconds)
$script:runEvent = Get-SentryTestEvent -EventId $resolvedEventId -TimeoutSeconds $remaining
} else {
Write-Host "Project events endpoint did not return the crash within $pollBudgetSeconds s; falling back to tag-via-issues lookup"
$script:runEvent = Get-SentryTestEvent -TagName "test.crash_id" -TagValue "$eventId" -TimeoutSeconds 30
}

Write-Host "::endgroup::"
}
}
Expand Down
Loading