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

feat: add common logic for supporting universe domain #621

Merged
merged 23 commits into from
Mar 14, 2024

Conversation

ohmayr
Copy link
Contributor

@ohmayr ohmayr commented Feb 27, 2024

Fixes #624 🦕

@ohmayr ohmayr requested review from a team as code owners February 27, 2024 03:39
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Feb 27, 2024
@ohmayr ohmayr changed the title add common logic for supporting universe domain feat: add common logic for supporting universe domain Feb 27, 2024
Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@parthea parthea marked this pull request as draft February 27, 2024 12:05
@ohmayr ohmayr marked this pull request as ready for review February 27, 2024 16:56
@parthea parthea self-assigned this Feb 29, 2024
Copy link
Contributor

@vchudnov-g vchudnov-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, but I left some comments.

One other comment: do you want to call this module universe_helpers?

from google.api_core import  universe_helpers

universe_helpers.get_universe_domain()
universe_helpers.compare_universes()

I wonder whether there are better names for this module and methods.

Maybe universe_domain.determine() and universe_domain.compare()? Or maybe we need slightly more explicit names than that (universe.determine_domain(), universe.compare_domains()?)

(Feel free to push back)

google/api_core/universe_helpers.py Outdated Show resolved Hide resolved
google/api_core/universe_helpers.py Outdated Show resolved Hide resolved
google/api_core/universe_helpers.py Outdated Show resolved Hide resolved
google/api_core/universe_helpers.py Outdated Show resolved Hide resolved
tests/unit/test_universe_helpers.py Outdated Show resolved Hide resolved
tests/unit/test_universe.py Show resolved Hide resolved
tests/unit/test_universe.py Outdated Show resolved Hide resolved
tests/unit/test_universe.py Outdated Show resolved Hide resolved
tests/unit/test_universe.py Outdated Show resolved Hide resolved
google/api_core/universe.py Outdated Show resolved Hide resolved
Copy link
Contributor

@vchudnov-g vchudnov-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you either use or remove the mTLS_Universe_Error declaration from this PR?. Right now it's not being used anywhere.

Aside from that, just a minor (non-blocking) testing suggestion.

tests/unit/test_universe.py Show resolved Hide resolved
google/api_core/universe.py Outdated Show resolved Hide resolved
assert str(excinfo.value).find(fake_domain) >= 0

with pytest.raises(universe.UniverseMismatchError) as excinfo:
universe.compare_domains(fake_domain, _Fake_Credentials())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These won't fit in one line? Darn.

tests/unit/test_universe.py Outdated Show resolved Hide resolved
@ohmayr ohmayr merged commit 94f2ca3 into main Mar 14, 2024
27 checks passed
@ohmayr ohmayr deleted the add-helpers-for-universe branch March 14, 2024 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add static code for supporting universe domain (to be used in both GAPICs and Apiary)
3 participants