Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 4662b39

Browse files
fix: Disable universe-domain validation (#839)
* chore: Update gapic-generator-python to v1.20.0 PiperOrigin-RevId: 689017451 Source-Link: googleapis/googleapis@2c7ba7e Source-Link: googleapis/googleapis-gen@55b4331 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTViNDMzMTliM2M4YzVmZGU2M2M5MTJiYTU1ZmVjZjQzMTBmMTBiYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.20.2 PiperOrigin-RevId: 691540410 Source-Link: googleapis/googleapis@b43cfb1 Source-Link: googleapis/googleapis-gen@40fd27b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDBmZDI3YjA4YWJiMmU4YjhhODRiNTc5NDFlMTIyNjk3MWYzN2E5NyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 148a06e commit 4662b39

File tree

12 files changed

+17
-586
lines changed

12 files changed

+17
-586
lines changed

google/cloud/bigquery_storage_v1/services/big_query_read/client.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -508,36 +508,6 @@ def _get_universe_domain(
508508
raise ValueError("Universe Domain cannot be an empty string.")
509509
return universe_domain
510510

511-
@staticmethod
512-
def _compare_universes(
513-
client_universe: str, credentials: ga_credentials.Credentials
514-
) -> bool:
515-
"""Returns True iff the universe domains used by the client and credentials match.
516-
517-
Args:
518-
client_universe (str): The universe domain configured via the client options.
519-
credentials (ga_credentials.Credentials): The credentials being used in the client.
520-
521-
Returns:
522-
bool: True iff client_universe matches the universe in credentials.
523-
524-
Raises:
525-
ValueError: when client_universe does not match the universe in credentials.
526-
"""
527-
528-
default_universe = BigQueryReadClient._DEFAULT_UNIVERSE
529-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
530-
531-
if client_universe != credentials_universe:
532-
raise ValueError(
533-
"The configured universe domain "
534-
f"({client_universe}) does not match the universe domain "
535-
f"found in the credentials ({credentials_universe}). "
536-
"If you haven't configured the universe domain explicitly, "
537-
f"`{default_universe}` is the default."
538-
)
539-
return True
540-
541511
def _validate_universe_domain(self):
542512
"""Validates client's and credentials' universe domains are consistent.
543513
@@ -547,13 +517,9 @@ def _validate_universe_domain(self):
547517
Raises:
548518
ValueError: If the configured universe domain is not valid.
549519
"""
550-
self._is_universe_domain_valid = (
551-
self._is_universe_domain_valid
552-
or BigQueryReadClient._compare_universes(
553-
self.universe_domain, self.transport._credentials
554-
)
555-
)
556-
return self._is_universe_domain_valid
520+
521+
# NOTE (b/349488459): universe validation is disabled until further notice.
522+
return True
557523

558524
@property
559525
def api_endpoint(self):

google/cloud/bigquery_storage_v1/services/big_query_write/client.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -492,36 +492,6 @@ def _get_universe_domain(
492492
raise ValueError("Universe Domain cannot be an empty string.")
493493
return universe_domain
494494

495-
@staticmethod
496-
def _compare_universes(
497-
client_universe: str, credentials: ga_credentials.Credentials
498-
) -> bool:
499-
"""Returns True iff the universe domains used by the client and credentials match.
500-
501-
Args:
502-
client_universe (str): The universe domain configured via the client options.
503-
credentials (ga_credentials.Credentials): The credentials being used in the client.
504-
505-
Returns:
506-
bool: True iff client_universe matches the universe in credentials.
507-
508-
Raises:
509-
ValueError: when client_universe does not match the universe in credentials.
510-
"""
511-
512-
default_universe = BigQueryWriteClient._DEFAULT_UNIVERSE
513-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
514-
515-
if client_universe != credentials_universe:
516-
raise ValueError(
517-
"The configured universe domain "
518-
f"({client_universe}) does not match the universe domain "
519-
f"found in the credentials ({credentials_universe}). "
520-
"If you haven't configured the universe domain explicitly, "
521-
f"`{default_universe}` is the default."
522-
)
523-
return True
524-
525495
def _validate_universe_domain(self):
526496
"""Validates client's and credentials' universe domains are consistent.
527497
@@ -531,13 +501,9 @@ def _validate_universe_domain(self):
531501
Raises:
532502
ValueError: If the configured universe domain is not valid.
533503
"""
534-
self._is_universe_domain_valid = (
535-
self._is_universe_domain_valid
536-
or BigQueryWriteClient._compare_universes(
537-
self.universe_domain, self.transport._credentials
538-
)
539-
)
540-
return self._is_universe_domain_valid
504+
505+
# NOTE (b/349488459): universe validation is disabled until further notice.
506+
return True
541507

542508
@property
543509
def api_endpoint(self):

google/cloud/bigquery_storage_v1alpha/services/metastore_partition_service/client.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -490,36 +490,6 @@ def _get_universe_domain(
490490
raise ValueError("Universe Domain cannot be an empty string.")
491491
return universe_domain
492492

493-
@staticmethod
494-
def _compare_universes(
495-
client_universe: str, credentials: ga_credentials.Credentials
496-
) -> bool:
497-
"""Returns True iff the universe domains used by the client and credentials match.
498-
499-
Args:
500-
client_universe (str): The universe domain configured via the client options.
501-
credentials (ga_credentials.Credentials): The credentials being used in the client.
502-
503-
Returns:
504-
bool: True iff client_universe matches the universe in credentials.
505-
506-
Raises:
507-
ValueError: when client_universe does not match the universe in credentials.
508-
"""
509-
510-
default_universe = MetastorePartitionServiceClient._DEFAULT_UNIVERSE
511-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
512-
513-
if client_universe != credentials_universe:
514-
raise ValueError(
515-
"The configured universe domain "
516-
f"({client_universe}) does not match the universe domain "
517-
f"found in the credentials ({credentials_universe}). "
518-
"If you haven't configured the universe domain explicitly, "
519-
f"`{default_universe}` is the default."
520-
)
521-
return True
522-
523493
def _validate_universe_domain(self):
524494
"""Validates client's and credentials' universe domains are consistent.
525495
@@ -529,13 +499,9 @@ def _validate_universe_domain(self):
529499
Raises:
530500
ValueError: If the configured universe domain is not valid.
531501
"""
532-
self._is_universe_domain_valid = (
533-
self._is_universe_domain_valid
534-
or MetastorePartitionServiceClient._compare_universes(
535-
self.universe_domain, self.transport._credentials
536-
)
537-
)
538-
return self._is_universe_domain_valid
502+
503+
# NOTE (b/349488459): universe validation is disabled until further notice.
504+
return True
539505

540506
@property
541507
def api_endpoint(self):

google/cloud/bigquery_storage_v1beta2/services/big_query_read/client.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -511,36 +511,6 @@ def _get_universe_domain(
511511
raise ValueError("Universe Domain cannot be an empty string.")
512512
return universe_domain
513513

514-
@staticmethod
515-
def _compare_universes(
516-
client_universe: str, credentials: ga_credentials.Credentials
517-
) -> bool:
518-
"""Returns True iff the universe domains used by the client and credentials match.
519-
520-
Args:
521-
client_universe (str): The universe domain configured via the client options.
522-
credentials (ga_credentials.Credentials): The credentials being used in the client.
523-
524-
Returns:
525-
bool: True iff client_universe matches the universe in credentials.
526-
527-
Raises:
528-
ValueError: when client_universe does not match the universe in credentials.
529-
"""
530-
531-
default_universe = BigQueryReadClient._DEFAULT_UNIVERSE
532-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
533-
534-
if client_universe != credentials_universe:
535-
raise ValueError(
536-
"The configured universe domain "
537-
f"({client_universe}) does not match the universe domain "
538-
f"found in the credentials ({credentials_universe}). "
539-
"If you haven't configured the universe domain explicitly, "
540-
f"`{default_universe}` is the default."
541-
)
542-
return True
543-
544514
def _validate_universe_domain(self):
545515
"""Validates client's and credentials' universe domains are consistent.
546516
@@ -550,13 +520,9 @@ def _validate_universe_domain(self):
550520
Raises:
551521
ValueError: If the configured universe domain is not valid.
552522
"""
553-
self._is_universe_domain_valid = (
554-
self._is_universe_domain_valid
555-
or BigQueryReadClient._compare_universes(
556-
self.universe_domain, self.transport._credentials
557-
)
558-
)
559-
return self._is_universe_domain_valid
523+
524+
# NOTE (b/349488459): universe validation is disabled until further notice.
525+
return True
560526

561527
@property
562528
def api_endpoint(self):

google/cloud/bigquery_storage_v1beta2/services/big_query_write/client.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -493,36 +493,6 @@ def _get_universe_domain(
493493
raise ValueError("Universe Domain cannot be an empty string.")
494494
return universe_domain
495495

496-
@staticmethod
497-
def _compare_universes(
498-
client_universe: str, credentials: ga_credentials.Credentials
499-
) -> bool:
500-
"""Returns True iff the universe domains used by the client and credentials match.
501-
502-
Args:
503-
client_universe (str): The universe domain configured via the client options.
504-
credentials (ga_credentials.Credentials): The credentials being used in the client.
505-
506-
Returns:
507-
bool: True iff client_universe matches the universe in credentials.
508-
509-
Raises:
510-
ValueError: when client_universe does not match the universe in credentials.
511-
"""
512-
513-
default_universe = BigQueryWriteClient._DEFAULT_UNIVERSE
514-
credentials_universe = getattr(credentials, "universe_domain", default_universe)
515-
516-
if client_universe != credentials_universe:
517-
raise ValueError(
518-
"The configured universe domain "
519-
f"({client_universe}) does not match the universe domain "
520-
f"found in the credentials ({credentials_universe}). "
521-
"If you haven't configured the universe domain explicitly, "
522-
f"`{default_universe}` is the default."
523-
)
524-
return True
525-
526496
def _validate_universe_domain(self):
527497
"""Validates client's and credentials' universe domains are consistent.
528498
@@ -532,13 +502,9 @@ def _validate_universe_domain(self):
532502
Raises:
533503
ValueError: If the configured universe domain is not valid.
534504
"""
535-
self._is_universe_domain_valid = (
536-
self._is_universe_domain_valid
537-
or BigQueryWriteClient._compare_universes(
538-
self.universe_domain, self.transport._credentials
539-
)
540-
)
541-
return self._is_universe_domain_valid
505+
506+
# NOTE (b/349488459): universe validation is disabled until further notice.
507+
return True
542508

543509
@property
544510
def api_endpoint(self):

samples/generated_samples/snippet_metadata_google.cloud.bigquery.storage.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-bigquery-storage",
11-
"version": "2.27.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.cloud.bigquery.storage.v1beta2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-bigquery-storage",
11-
"version": "2.27.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

tests/unit/gapic/bigquery_storage_v1/test_big_query_read.py

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -298,85 +298,6 @@ def test__get_universe_domain():
298298
assert str(excinfo.value) == "Universe Domain cannot be an empty string."
299299

300300

301-
@pytest.mark.parametrize(
302-
"client_class,transport_class,transport_name",
303-
[
304-
(BigQueryReadClient, transports.BigQueryReadGrpcTransport, "grpc"),
305-
],
306-
)
307-
def test__validate_universe_domain(client_class, transport_class, transport_name):
308-
client = client_class(
309-
transport=transport_class(credentials=ga_credentials.AnonymousCredentials())
310-
)
311-
assert client._validate_universe_domain() == True
312-
313-
# Test the case when universe is already validated.
314-
assert client._validate_universe_domain() == True
315-
316-
if transport_name == "grpc":
317-
# Test the case where credentials are provided by the
318-
# `local_channel_credentials`. The default universes in both match.
319-
channel = grpc.secure_channel(
320-
"http://localhost/", grpc.local_channel_credentials()
321-
)
322-
client = client_class(transport=transport_class(channel=channel))
323-
assert client._validate_universe_domain() == True
324-
325-
# Test the case where credentials do not exist: e.g. a transport is provided
326-
# with no credentials. Validation should still succeed because there is no
327-
# mismatch with non-existent credentials.
328-
channel = grpc.secure_channel(
329-
"http://localhost/", grpc.local_channel_credentials()
330-
)
331-
transport = transport_class(channel=channel)
332-
transport._credentials = None
333-
client = client_class(transport=transport)
334-
assert client._validate_universe_domain() == True
335-
336-
# TODO: This is needed to cater for older versions of google-auth
337-
# Make this test unconditional once the minimum supported version of
338-
# google-auth becomes 2.23.0 or higher.
339-
google_auth_major, google_auth_minor = [
340-
int(part) for part in google.auth.__version__.split(".")[0:2]
341-
]
342-
if google_auth_major > 2 or (google_auth_major == 2 and google_auth_minor >= 23):
343-
credentials = ga_credentials.AnonymousCredentials()
344-
credentials._universe_domain = "foo.com"
345-
# Test the case when there is a universe mismatch from the credentials.
346-
client = client_class(transport=transport_class(credentials=credentials))
347-
with pytest.raises(ValueError) as excinfo:
348-
client._validate_universe_domain()
349-
assert (
350-
str(excinfo.value)
351-
== "The configured universe domain (googleapis.com) does not match the universe domain found in the credentials (foo.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default."
352-
)
353-
354-
# Test the case when there is a universe mismatch from the client.
355-
#
356-
# TODO: Make this test unconditional once the minimum supported version of
357-
# google-api-core becomes 2.15.0 or higher.
358-
api_core_major, api_core_minor = [
359-
int(part) for part in api_core_version.__version__.split(".")[0:2]
360-
]
361-
if api_core_major > 2 or (api_core_major == 2 and api_core_minor >= 15):
362-
client = client_class(
363-
client_options={"universe_domain": "bar.com"},
364-
transport=transport_class(
365-
credentials=ga_credentials.AnonymousCredentials(),
366-
),
367-
)
368-
with pytest.raises(ValueError) as excinfo:
369-
client._validate_universe_domain()
370-
assert (
371-
str(excinfo.value)
372-
== "The configured universe domain (bar.com) does not match the universe domain found in the credentials (googleapis.com). If you haven't configured the universe domain explicitly, `googleapis.com` is the default."
373-
)
374-
375-
# Test that ValueError is raised if universe_domain is provided via client options and credentials is None
376-
with pytest.raises(ValueError):
377-
client._compare_universes("foo.bar", None)
378-
379-
380301
@pytest.mark.parametrize(
381302
"client_class,transport_name",
382303
[

0 commit comments

Comments
 (0)