You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was using github.com/jarcoal/httpmock with the old (now deprecated) API client our app. We have a test suite must run mocking tests before running integration tests as the next step. Upon upgrading to the this new OpenAPI client, I discovered that at this point, we're running into a panic caused by that line of code:
interface conversion: net/http.RoundTripper is *github.com/jarcoal/http.MockTransport,
not *net/http.Transport
It seems like an overly opinionated or short sighted requirement, that the transport MUST be *net/http.Transport. For one thing this breaks mocking. Looking at it another way, whats the point of allowing the user to set TransportConfig if down the line you're making an assertion that its a specific thing?
The text was updated successfully, but these errors were encountered:
sylnsr
changed the title
Assertion makes mocking impossible
Assertion: http.DefaultTransport.(*http.Transport) ... makes mocking impossible
May 17, 2024
On a side note, for any one else running into this, the work around for the issue with that particular mocking framework is not to use httpmock.Activate() to activate the framework, but instead to use httpmock.ActivateNonDefault(&http.Client{}). (Correction, there is no solution)
Regarding
grafana-openapi-client-go/client/grafana_http_api_client.go
Line 416 in 3ad0f7e
I was using github.com/jarcoal/httpmock with the old (now deprecated) API client our app. We have a test suite must run mocking tests before running integration tests as the next step. Upon upgrading to the this new OpenAPI client, I discovered that at this point, we're running into a panic caused by that line of code:
It seems like an overly opinionated or short sighted requirement, that the transport MUST be *net/http.Transport. For one thing this breaks mocking. Looking at it another way, whats the point of allowing the user to set TransportConfig if down the line you're making an assertion that its a specific thing?
The text was updated successfully, but these errors were encountered: