-
Notifications
You must be signed in to change notification settings - Fork 56
fix: client_info default values #681
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
Changes from all commits
50f07f5
428ec68
09628f3
ef26b79
9394c1c
d46c642
0a33d56
3cce324
f52dd6c
bfddc75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,22 @@ def modify_default_endpoint(client): | |
) | ||
|
||
|
||
def test_logging_default_client_info_headers(): | ||
import re | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like repeated code - can you create one function controlled/operated by parameters? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah unfortunately a lot of these test files contain mostly repeated test code pointed at different services. I considered making a different file for just these tests that could share more logic, but then decided to follow the existing conventions instead. Let me know if you think that makes sense There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you not plan to fix it in tests now, I guess lets open a bug and solve it later - lets keep a good standard to avoid code duplication |
||
import pkg_resources | ||
|
||
# test that DEFAULT_CLIENT_INFO contains the expected gapic headers | ||
gapic_header_regex = re.compile( | ||
r"gapic\/[0-9]+\.[\w.-]+ gax\/[0-9]+\.[\w.-]+ gl-python\/[0-9]+\.[\w.-]+ grpc\/[0-9]+\.[\w.-]+" | ||
) | ||
detected_info = ( | ||
google.cloud.logging_v2.services.logging_service_v2.transports.base.DEFAULT_CLIENT_INFO | ||
) | ||
assert detected_info is not None | ||
detected_agent = " ".join(sorted(detected_info.to_user_agent().split(" "))) | ||
assert gapic_header_regex.match(detected_agent) | ||
|
||
|
||
def test__get_default_mtls_endpoint(): | ||
api_endpoint = "example.googleapis.com" | ||
api_mtls_endpoint = "example.mtls.googleapis.com" | ||
|
Uh oh!
There was an error while loading. Please reload this page.