Skip to content

test(native): eliminate sleeps and restarts#1619

Merged
jpnurmi merged 3 commits intomasterfrom
jpnurmi/test/native-integration
Apr 1, 2026
Merged

test(native): eliminate sleeps and restarts#1619
jpnurmi merged 3 commits intomasterfrom
jpnurmi/test/native-integration

Conversation

@jpnurmi
Copy link
Copy Markdown
Collaborator

@jpnurmi jpnurmi commented Apr 1, 2026

Use httpserver.wait() context managers and expect_oneshot_request() instead of time.sleep(2) + restart patterns for more reliable and faster test execution.

In busy CI environments, crash processing might exceed 2s. In a fast local development environment, however, it often doesn't take more than a few hundred milliseconds, so unconditional 2s sleeps unnecessarily slow down the test execution. httpserver.wait(timeout=10) combined with expect_oneshot_request() is perfect because it only waits the time it actually takes to receive the request, while being flexible up to 10s if necessary in busy CI environments.

Also, the daemon has a 10s shutdown timeout, which should be enough to flush envelopes in tests, meaning the restarts should not be necessary (famous last words?)

#define SENTRY_CRASH_TRANSPORT_SHUTDOWN_TIMEOUT_MS \
10000 // 10 seconds for transport shutdown (increased for TSAN/ASAN builds)

Before, pytest tests/test_integration_native.py took roughly 45s on my Mac. With this, it takes less than 10s.

jpnurmi and others added 2 commits April 1, 2026 08:56
Use httpserver.wait() context managers and expect_oneshot_request()
instead of time.sleep() + restart patterns for more reliable and
faster test execution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jpnurmi jpnurmi marked this pull request as ready for review April 1, 2026 09:29
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jpnurmi jpnurmi merged commit 08ef82f into master Apr 1, 2026
53 checks passed
@jpnurmi jpnurmi deleted the jpnurmi/test/native-integration branch April 1, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants