As noted in a code comment in #12755 (comment here), we have not yet added a test to the stackdriver_metrics sink as doing so would require mocking the OAuth2 endpoint that is used to generate a token for furthering interacting with the actual Stackdriver Metrics API. Doing so in a clean way was a bit too much work for the aforementioned PR.
We should extend the simple spawn_http_blackhole_server machinery with a richer set of helper methods, or potentially types, for mocking not only the service under test, but also the OAuth2 phase where credentials are used to request/refresh a token before actually calling the service.
As all GCP APIs use OAuth2, we should not only do this and use it for the stackdriver_metrics sink, but for all other GCP sinks where OAuth2 is used. This might also imply needing to unify how we parse credentials and generate tokens for GCP sinks i.e. switch exclusively to goauth or gouth, and remove the other.
As noted in a code comment in #12755 (comment here), we have not yet added a test to the
stackdriver_metrics
sink as doing so would require mocking the OAuth2 endpoint that is used to generate a token for furthering interacting with the actual Stackdriver Metrics API. Doing so in a clean way was a bit too much work for the aforementioned PR.We should extend the simple
spawn_http_blackhole_server
machinery with a richer set of helper methods, or potentially types, for mocking not only the service under test, but also the OAuth2 phase where credentials are used to request/refresh a token before actually calling the service.As all GCP APIs use OAuth2, we should not only do this and use it for the
stackdriver_metrics
sink, but for all other GCP sinks where OAuth2 is used. This might also imply needing to unify how we parse credentials and generate tokens for GCP sinks i.e. switch exclusively togoauth
orgouth
, and remove the other.