GAPICs are designed to allow users to only configure one of transport or credentials. If a transport is configured explicitly, then it must be instantiated with credentials.
in google.cloud.pubsub_v1, if the environment variable PUBSUB_EMULATOR_HOST is set, the credentials are automatically set to AnonymousCredentials in the client layer.
This means that if PUBSUB_EMULATOR_HOST is set, then credentials are automatically configured under the hood for test cases.
Given that we want to update the following test to explicitly configure a transport to the client (with an intercept channel), we want to make sure that credentials are provided to the transport instance and not on the client instance directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GAPICs are designed to allow users to only configure one of transport or credentials. If a transport is configured explicitly, then it must be instantiated with credentials.
gapic-generator: See: https://github.com/googleapis/gapic-generator-python/blob/main/gapic/templates/%25namespace/%25name_%25version/%25sub/services/%25service/client.py.j2#L563.
pubsub: https://github.com/googleapis/python-pubsub/blob/main/google/pubsub_v1/services/publisher/client.py#L678
in google.cloud.pubsub_v1, if the environment variable PUBSUB_EMULATOR_HOST is set, the credentials are automatically set to AnonymousCredentials in the client layer.
This means that if PUBSUB_EMULATOR_HOST is set, then credentials are automatically configured under the hood for test cases.
This behaviour results in an issue if a test sets PUBSUB_EMULATOR_HOST explicitly and provides a transport to a client, resulting in the following error to be raised https://github.com/googleapis/python-pubsub/blob/main/google/pubsub_v1/services/publisher/client.py#L678.
Given that we want to update the following test to explicitly configure a transport to the client (with an intercept channel), we want to make sure that credentials are provided to the transport instance and not on the client instance directly.