Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose MockTransport in a testhelpers package #971

Open
lukasschwab opened this issue Feb 28, 2025 · 1 comment · May be fixed by #972
Open

Expose MockTransport in a testhelpers package #971

lukasschwab opened this issue Feb 28, 2025 · 1 comment · May be fixed by #972

Comments

@lukasschwab
Copy link

Problem Statement

I'm integrating Sentry into an existing application, and I want to confirm my application sends expected data to Sentry. A client with a mocked transport layer fits the bill.

Solution Brainstorm

I suggest exposing the TransportMock

It's even duplicated, for exactly the same reason I have: TransportMock is useful for testing a program's interaction with Sentry. The duplicated code has a FIXME comment from :

// FIXME(anton): TransportMock is copied from mocks_test.go
// I don't see an easy way right now to reuse this struct in "sentry" and
// "sentryotel" packages: it naturally depends on "sentry", but tests in "sentry"
// package also depend on it, so if we move it to a new package, we'll get an
// import cycle.
// Alternatively, it could be made public on "sentry" package, but it doesn't
// feel right.

cc @tonyo — I think a clear docstring explaining the meaning of TransportMock should be clear enough to prevent someone accidentally using it.

Happy to open a PR implementing the above and removing the duplication 🙇

@tonyo
Copy link
Contributor

tonyo commented Feb 28, 2025

I don't mind :) I'm not with Sentry anymore though, so will delegate to the maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants