From e5ae79ad63ffd963e02c8521c808a4170225eb40 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 25 Apr 2025 16:59:08 -0700 Subject: [PATCH 01/12] reverted header patch --- .../cloud/bigtable_v2/services/bigtable/async_client.py | 8 ++------ google/cloud/bigtable_v2/services/bigtable/client.py | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/google/cloud/bigtable_v2/services/bigtable/async_client.py b/google/cloud/bigtable_v2/services/bigtable/async_client.py index 84832ffd6..0ae20f3a2 100644 --- a/google/cloud/bigtable_v2/services/bigtable/async_client.py +++ b/google/cloud/bigtable_v2/services/bigtable/async_client.py @@ -1584,9 +1584,7 @@ async def prepare_query( if regex_match and regex_match.group("name"): header_params["name"] = regex_match.group("name") - if request.app_profile_id is not None: - # prepare_query currently requires app_profile_id header to be set - # even when the request param is unpopulated TODO: remove after support is added + if request.app_profile_id: header_params["app_profile_id"] = request.app_profile_id if header_params: @@ -1706,9 +1704,7 @@ def execute_query( if regex_match and regex_match.group("name"): header_params["name"] = regex_match.group("name") - if request.app_profile_id is not None: - # execute_query currently requires app_profile_id header to be set - # even when the request param is unpopulated TODO: remove after support is added + if request.app_profile_id: header_params["app_profile_id"] = request.app_profile_id if header_params: diff --git a/google/cloud/bigtable_v2/services/bigtable/client.py b/google/cloud/bigtable_v2/services/bigtable/client.py index c5b14b54a..2835a10cf 100644 --- a/google/cloud/bigtable_v2/services/bigtable/client.py +++ b/google/cloud/bigtable_v2/services/bigtable/client.py @@ -2033,9 +2033,7 @@ def prepare_query( if regex_match and regex_match.group("name"): header_params["name"] = regex_match.group("name") - if request.app_profile_id is not None: - # prepare_query currently requires app_profile_id header to be set - # even when the request param is unpopulated TODO: remove after support is added + if request.app_profile_id: header_params["app_profile_id"] = request.app_profile_id if header_params: @@ -2152,9 +2150,7 @@ def execute_query( if regex_match and regex_match.group("name"): header_params["name"] = regex_match.group("name") - if request.app_profile_id is not None: - # execute_query currently requires app_profile_id header to be set - # even when the request param is unpopulated TODO: remove after support is added + if request.app_profile_id: header_params["app_profile_id"] = request.app_profile_id if header_params: From c5defb8d09a367fb94a1e5a1a106b10a65064e28 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 25 Apr 2025 16:59:53 -0700 Subject: [PATCH 02/12] added owlbot step to keep app_profile_id --- owlbot.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/owlbot.py b/owlbot.py index 16ce11b4f..60a37e9a8 100644 --- a/owlbot.py +++ b/owlbot.py @@ -97,6 +97,18 @@ def get_staging_dirs( s.move(templated_files, excludes=[".coveragerc", "README.rst", ".github/release-please.yml", "noxfile.py"]) + +# ---------------------------------------------------------------------------- +# Always supply app_profile_id in routing headers: https://github.com/googleapis/python-bigtable/pull/1109 +# ---------------------------------------------------------------------------- +for file in ["async_client.py", "client.py"]: + s.replace( + f"google/cloud/bigtable_v2/services/bigtable/{file}", + "if request.app_profile_id:", + "if True: # always attach app_profile_id, even if empty string. TODO: remove after support is added" + ) + + # ---------------------------------------------------------------------------- # Samples templates # ---------------------------------------------------------------------------- From ca93ccb028a548be4993241e2af7867b358564e5 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 25 Apr 2025 17:12:25 -0700 Subject: [PATCH 03/12] moved todo --- owlbot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/owlbot.py b/owlbot.py index 60a37e9a8..cbc0bedca 100644 --- a/owlbot.py +++ b/owlbot.py @@ -100,12 +100,13 @@ def get_staging_dirs( # ---------------------------------------------------------------------------- # Always supply app_profile_id in routing headers: https://github.com/googleapis/python-bigtable/pull/1109 +# TODO: remove after backend no longer requires empty strings # ---------------------------------------------------------------------------- for file in ["async_client.py", "client.py"]: s.replace( f"google/cloud/bigtable_v2/services/bigtable/{file}", "if request.app_profile_id:", - "if True: # always attach app_profile_id, even if empty string. TODO: remove after support is added" + "if True: # always attach app_profile_id, even if empty string" ) From 790cafa0f642e2a33f290b1d0b348574e6d6dde1 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 25 Apr 2025 17:16:38 -0700 Subject: [PATCH 04/12] revert test change --- tests/unit/gapic/bigtable_v2/test_bigtable.py | 36 ++++--------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/tests/unit/gapic/bigtable_v2/test_bigtable.py b/tests/unit/gapic/bigtable_v2/test_bigtable.py index 1750be32b..059e6a58c 100644 --- a/tests/unit/gapic/bigtable_v2/test_bigtable.py +++ b/tests/unit/gapic/bigtable_v2/test_bigtable.py @@ -7442,11 +7442,7 @@ def test_prepare_query_routing_parameters_request_1_grpc(): assert args[0] == request_msg - # expect app_profile_id while temporary patch is in place: https://github.com/googleapis/python-bigtable/pull/1072 - expected_headers = { - "name": "projects/sample1/instances/sample2", - "app_profile_id": "", - } + expected_headers = {"name": "projects/sample1/instances/sample2"} assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -7498,11 +7494,7 @@ def test_execute_query_routing_parameters_request_1_grpc(): assert args[0] == request_msg - # expect app_profile_id while temporary patch is in place: https://github.com/googleapis/python-bigtable/pull/1072 - expected_headers = { - "name": "projects/sample1/instances/sample2", - "app_profile_id": "", - } + expected_headers = {"name": "projects/sample1/instances/sample2"} assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -8556,11 +8548,7 @@ async def test_prepare_query_routing_parameters_request_1_grpc_asyncio(): assert args[0] == request_msg - # expect app_profile_id while temporary patch is in place: https://github.com/googleapis/python-bigtable/pull/1072 - expected_headers = { - "name": "projects/sample1/instances/sample2", - "app_profile_id": "", - } + expected_headers = {"name": "projects/sample1/instances/sample2"} assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -8623,11 +8611,7 @@ async def test_execute_query_routing_parameters_request_1_grpc_asyncio(): assert args[0] == request_msg - # expect app_profile_id while temporary patch is in place: https://github.com/googleapis/python-bigtable/pull/1072 - expected_headers = { - "name": "projects/sample1/instances/sample2", - "app_profile_id": "", - } + expected_headers = {"name": "projects/sample1/instances/sample2"} assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -10878,11 +10862,7 @@ def test_prepare_query_routing_parameters_request_1_rest(): assert args[0] == request_msg - # expect app_profile_id while temporary patch is in place: https://github.com/googleapis/python-bigtable/pull/1072 - expected_headers = { - "name": "projects/sample1/instances/sample2", - "app_profile_id": "", - } + expected_headers = {"name": "projects/sample1/instances/sample2"} assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -10932,11 +10912,7 @@ def test_execute_query_routing_parameters_request_1_rest(): assert args[0] == request_msg - # expect app_profile_id while temporary patch is in place: https://github.com/googleapis/python-bigtable/pull/1072 - expected_headers = { - "name": "projects/sample1/instances/sample2", - "app_profile_id": "", - } + expected_headers = {"name": "projects/sample1/instances/sample2"} assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) From a7e211024a7ad795f2745cc233f3ee46c1202a1e Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 25 Apr 2025 17:16:56 -0700 Subject: [PATCH 05/12] add owlbot step to fix tests --- owlbot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/owlbot.py b/owlbot.py index cbc0bedca..747653606 100644 --- a/owlbot.py +++ b/owlbot.py @@ -108,7 +108,12 @@ def get_staging_dirs( "if request.app_profile_id:", "if True: # always attach app_profile_id, even if empty string" ) - +# fix tests +s.replace( + "tests/unit/gapic/bigtable_v2/test_bigtable.py", + 'expected_headers = {"name": "projects/sample1/instances/sample2"}', + 'expected_headers = {"name": "projects/sample1/instances/sample2", "app_profile_id": ""}' +) # ---------------------------------------------------------------------------- # Samples templates From ab694462addbe24631dbd4e6da0b26ebb8ab0d0b Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 25 Apr 2025 17:30:35 -0700 Subject: [PATCH 06/12] added more test changes --- owlbot.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/owlbot.py b/owlbot.py index 747653606..c589900eb 100644 --- a/owlbot.py +++ b/owlbot.py @@ -114,6 +114,34 @@ def get_staging_dirs( 'expected_headers = {"name": "projects/sample1/instances/sample2"}', 'expected_headers = {"name": "projects/sample1/instances/sample2", "app_profile_id": ""}' ) +s.replace( + "tests/unit/gapic/bigtable_v2/test_bigtable.py", + """ + expected_headers = { + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + } + """, + """ + expected_headers = { + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", + "app_profile_id": "" + } + """ +) +s.replace( + "tests/unit/gapic/bigtable_v2/test_bigtable.py", + """ + expected_headers = { + "table_name": "projects/sample1/instances/sample2/tables/sample3" + } + """, + """ + expected_headers = { + "table_name": "projects/sample1/instances/sample2/tables/sample3" + "app_profile_id": "" + } + """ +) # ---------------------------------------------------------------------------- # Samples templates From 279455f60d56f118162ff8b1b88f74a01cd1f362 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 25 Apr 2025 17:35:13 -0700 Subject: [PATCH 07/12] added missing , --- owlbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/owlbot.py b/owlbot.py index c589900eb..9e63ec197 100644 --- a/owlbot.py +++ b/owlbot.py @@ -137,7 +137,7 @@ def get_staging_dirs( """, """ expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", "app_profile_id": "" } """ From 5ccdba5b2bbdae824fbd9a3be0eeb0dfcbc9d344 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Mon, 28 Apr 2025 09:32:29 -0700 Subject: [PATCH 08/12] changed order --- owlbot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/owlbot.py b/owlbot.py index 9e63ec197..f144a2d21 100644 --- a/owlbot.py +++ b/owlbot.py @@ -123,8 +123,8 @@ def get_staging_dirs( """, """ expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", - "app_profile_id": "" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" } """ ) From e301c92a0c3760b3d86c18ffab1401889f74aee5 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Mon, 28 Apr 2025 09:35:16 -0700 Subject: [PATCH 09/12] check calls for app_profile_id --- tests/unit/data/_async/test_client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/data/_async/test_client.py b/tests/unit/data/_async/test_client.py index 96fcf66b3..f45a17bf6 100644 --- a/tests/unit/data/_async/test_client.py +++ b/tests/unit/data/_async/test_client.py @@ -1311,7 +1311,8 @@ async def test_call_metadata(self, include_app_profile, fn_name, fn_args, gapic_ if include_app_profile: assert "app_profile_id=profile" in routing_str else: - assert "app_profile_id=" not in routing_str + # empty app_profile_id should send empty string + assert "app_profile_id=" in routing_str @CrossSync.convert_class( From cf592212f521ccb6012b2877a21bae75b08cf247 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Mon, 28 Apr 2025 10:00:08 -0700 Subject: [PATCH 10/12] updated sync code --- tests/unit/data/_sync_autogen/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/data/_sync_autogen/test_client.py b/tests/unit/data/_sync_autogen/test_client.py index 720f0e0b6..eea3f36bf 100644 --- a/tests/unit/data/_sync_autogen/test_client.py +++ b/tests/unit/data/_sync_autogen/test_client.py @@ -1052,7 +1052,7 @@ def test_call_metadata(self, include_app_profile, fn_name, fn_args, gapic_fn): if include_app_profile: assert "app_profile_id=profile" in routing_str else: - assert "app_profile_id=" not in routing_str + assert "app_profile_id=" in routing_str @CrossSync._Sync_Impl.add_mapping_decorator("TestReadRows") From 4d3fab1619bb606891586cf1e9426bac80f7a375 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 28 Apr 2025 18:50:34 +0000 Subject: [PATCH 11/12] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../services/bigtable/async_client.py | 18 +-- .../bigtable_v2/services/bigtable/client.py | 18 +-- tests/unit/gapic/bigtable_v2/test_bigtable.py | 153 ++++++++++++------ 3 files changed, 126 insertions(+), 63 deletions(-) diff --git a/google/cloud/bigtable_v2/services/bigtable/async_client.py b/google/cloud/bigtable_v2/services/bigtable/async_client.py index 0ae20f3a2..3ca8bb256 100644 --- a/google/cloud/bigtable_v2/services/bigtable/async_client.py +++ b/google/cloud/bigtable_v2/services/bigtable/async_client.py @@ -386,7 +386,7 @@ def read_rows( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -510,7 +510,7 @@ def sample_row_keys( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -655,7 +655,7 @@ async def mutate_row( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -794,7 +794,7 @@ def mutate_rows( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -974,7 +974,7 @@ async def check_and_mutate_row( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -1093,7 +1093,7 @@ async def ping_and_warm( if regex_match and regex_match.group("name"): header_params["name"] = regex_match.group("name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id if header_params: @@ -1235,7 +1235,7 @@ async def read_modify_write_row( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -1584,7 +1584,7 @@ async def prepare_query( if regex_match and regex_match.group("name"): header_params["name"] = regex_match.group("name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id if header_params: @@ -1704,7 +1704,7 @@ def execute_query( if regex_match and regex_match.group("name"): header_params["name"] = regex_match.group("name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id if header_params: diff --git a/google/cloud/bigtable_v2/services/bigtable/client.py b/google/cloud/bigtable_v2/services/bigtable/client.py index 2835a10cf..ba3eb9de3 100644 --- a/google/cloud/bigtable_v2/services/bigtable/client.py +++ b/google/cloud/bigtable_v2/services/bigtable/client.py @@ -862,7 +862,7 @@ def read_rows( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -983,7 +983,7 @@ def sample_row_keys( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -1125,7 +1125,7 @@ def mutate_row( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -1261,7 +1261,7 @@ def mutate_rows( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -1438,7 +1438,7 @@ def check_and_mutate_row( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -1554,7 +1554,7 @@ def ping_and_warm( if regex_match and regex_match.group("name"): header_params["name"] = regex_match.group("name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id if header_params: @@ -1693,7 +1693,7 @@ def read_modify_write_row( if regex_match and regex_match.group("table_name"): header_params["table_name"] = regex_match.group("table_name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id routing_param_regex = re.compile( @@ -2033,7 +2033,7 @@ def prepare_query( if regex_match and regex_match.group("name"): header_params["name"] = regex_match.group("name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id if header_params: @@ -2150,7 +2150,7 @@ def execute_query( if regex_match and regex_match.group("name"): header_params["name"] = regex_match.group("name") - if request.app_profile_id: + if True: # always attach app_profile_id, even if empty string header_params["app_profile_id"] = request.app_profile_id if header_params: diff --git a/tests/unit/gapic/bigtable_v2/test_bigtable.py b/tests/unit/gapic/bigtable_v2/test_bigtable.py index 059e6a58c..dba535dcc 100644 --- a/tests/unit/gapic/bigtable_v2/test_bigtable.py +++ b/tests/unit/gapic/bigtable_v2/test_bigtable.py @@ -6851,7 +6851,8 @@ def test_read_rows_routing_parameters_request_1_grpc(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -6909,7 +6910,8 @@ def test_read_rows_routing_parameters_request_3_grpc(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -6939,7 +6941,8 @@ def test_sample_row_keys_routing_parameters_request_1_grpc(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -6997,7 +7000,8 @@ def test_sample_row_keys_routing_parameters_request_3_grpc(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7027,7 +7031,8 @@ def test_mutate_row_routing_parameters_request_1_grpc(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7085,7 +7090,8 @@ def test_mutate_row_routing_parameters_request_3_grpc(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7115,7 +7121,8 @@ def test_mutate_rows_routing_parameters_request_1_grpc(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7173,7 +7180,8 @@ def test_mutate_rows_routing_parameters_request_3_grpc(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7205,7 +7213,8 @@ def test_check_and_mutate_row_routing_parameters_request_1_grpc(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7267,7 +7276,8 @@ def test_check_and_mutate_row_routing_parameters_request_3_grpc(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7294,7 +7304,10 @@ def test_ping_and_warm_routing_parameters_request_1_grpc(): assert args[0] == request_msg - expected_headers = {"name": "projects/sample1/instances/sample2"} + expected_headers = { + "name": "projects/sample1/instances/sample2", + "app_profile_id": "", + } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -7349,7 +7362,8 @@ def test_read_modify_write_row_routing_parameters_request_1_grpc(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7413,7 +7427,8 @@ def test_read_modify_write_row_routing_parameters_request_3_grpc(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7442,7 +7457,10 @@ def test_prepare_query_routing_parameters_request_1_grpc(): assert args[0] == request_msg - expected_headers = {"name": "projects/sample1/instances/sample2"} + expected_headers = { + "name": "projects/sample1/instances/sample2", + "app_profile_id": "", + } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -7494,7 +7512,10 @@ def test_execute_query_routing_parameters_request_1_grpc(): assert args[0] == request_msg - expected_headers = {"name": "projects/sample1/instances/sample2"} + expected_headers = { + "name": "projects/sample1/instances/sample2", + "app_profile_id": "", + } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -7859,7 +7880,8 @@ async def test_read_rows_routing_parameters_request_1_grpc_asyncio(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7927,7 +7949,8 @@ async def test_read_rows_routing_parameters_request_3_grpc_asyncio(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -7962,7 +7985,8 @@ async def test_sample_row_keys_routing_parameters_request_1_grpc_asyncio(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -8030,7 +8054,8 @@ async def test_sample_row_keys_routing_parameters_request_3_grpc_asyncio(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -8064,7 +8089,8 @@ async def test_mutate_row_routing_parameters_request_1_grpc_asyncio(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -8130,7 +8156,8 @@ async def test_mutate_row_routing_parameters_request_3_grpc_asyncio(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -8165,7 +8192,8 @@ async def test_mutate_rows_routing_parameters_request_1_grpc_asyncio(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -8233,7 +8261,8 @@ async def test_mutate_rows_routing_parameters_request_3_grpc_asyncio(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -8271,7 +8300,8 @@ async def test_check_and_mutate_row_routing_parameters_request_1_grpc_asyncio(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -8345,7 +8375,8 @@ async def test_check_and_mutate_row_routing_parameters_request_3_grpc_asyncio(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -8378,7 +8409,10 @@ async def test_ping_and_warm_routing_parameters_request_1_grpc_asyncio(): assert args[0] == request_msg - expected_headers = {"name": "projects/sample1/instances/sample2"} + expected_headers = { + "name": "projects/sample1/instances/sample2", + "app_profile_id": "", + } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -8441,7 +8475,8 @@ async def test_read_modify_write_row_routing_parameters_request_1_grpc_asyncio() assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -8513,7 +8548,8 @@ async def test_read_modify_write_row_routing_parameters_request_3_grpc_asyncio() assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -8548,7 +8584,10 @@ async def test_prepare_query_routing_parameters_request_1_grpc_asyncio(): assert args[0] == request_msg - expected_headers = {"name": "projects/sample1/instances/sample2"} + expected_headers = { + "name": "projects/sample1/instances/sample2", + "app_profile_id": "", + } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -8611,7 +8650,10 @@ async def test_execute_query_routing_parameters_request_1_grpc_asyncio(): assert args[0] == request_msg - expected_headers = {"name": "projects/sample1/instances/sample2"} + expected_headers = { + "name": "projects/sample1/instances/sample2", + "app_profile_id": "", + } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -10291,7 +10333,8 @@ def test_read_rows_routing_parameters_request_1_rest(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10347,7 +10390,8 @@ def test_read_rows_routing_parameters_request_3_rest(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10376,7 +10420,8 @@ def test_sample_row_keys_routing_parameters_request_1_rest(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10432,7 +10477,8 @@ def test_sample_row_keys_routing_parameters_request_3_rest(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10461,7 +10507,8 @@ def test_mutate_row_routing_parameters_request_1_rest(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10517,7 +10564,8 @@ def test_mutate_row_routing_parameters_request_3_rest(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10546,7 +10594,8 @@ def test_mutate_rows_routing_parameters_request_1_rest(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10602,7 +10651,8 @@ def test_mutate_rows_routing_parameters_request_3_rest(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10633,7 +10683,8 @@ def test_check_and_mutate_row_routing_parameters_request_1_rest(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10693,7 +10744,8 @@ def test_check_and_mutate_row_routing_parameters_request_3_rest(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10719,7 +10771,10 @@ def test_ping_and_warm_routing_parameters_request_1_rest(): assert args[0] == request_msg - expected_headers = {"name": "projects/sample1/instances/sample2"} + expected_headers = { + "name": "projects/sample1/instances/sample2", + "app_profile_id": "", + } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -10772,7 +10827,8 @@ def test_read_modify_write_row_routing_parameters_request_1_rest(): assert args[0] == request_msg expected_headers = { - "table_name": "projects/sample1/instances/sample2/tables/sample3" + "table_name": "projects/sample1/instances/sample2/tables/sample3", + "app_profile_id": "", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10834,7 +10890,8 @@ def test_read_modify_write_row_routing_parameters_request_3_rest(): assert args[0] == request_msg expected_headers = { - "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4" + "app_profile_id": "", + "authorized_view_name": "projects/sample1/instances/sample2/tables/sample3/authorizedViews/sample4", } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] @@ -10862,7 +10919,10 @@ def test_prepare_query_routing_parameters_request_1_rest(): assert args[0] == request_msg - expected_headers = {"name": "projects/sample1/instances/sample2"} + expected_headers = { + "name": "projects/sample1/instances/sample2", + "app_profile_id": "", + } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) @@ -10912,7 +10972,10 @@ def test_execute_query_routing_parameters_request_1_rest(): assert args[0] == request_msg - expected_headers = {"name": "projects/sample1/instances/sample2"} + expected_headers = { + "name": "projects/sample1/instances/sample2", + "app_profile_id": "", + } assert ( gapic_v1.routing_header.to_grpc_metadata(expected_headers) in kw["metadata"] ) From 3e6bd688864bfb8791087bc657e268f1873734ad Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Mon, 28 Apr 2025 13:01:17 -0700 Subject: [PATCH 12/12] disable emulator channel refresh test --- tests/system/data/test_system_async.py | 4 ++++ tests/system/data/test_system_autogen.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/system/data/test_system_async.py b/tests/system/data/test_system_async.py index 53e97acc1..d45c7c16e 100644 --- a/tests/system/data/test_system_async.py +++ b/tests/system/data/test_system_async.py @@ -207,6 +207,10 @@ async def test_ping_and_warm(self, client, table): assert len(results) == 1 assert results[0] is None + @pytest.mark.skipif( + bool(os.environ.get(BIGTABLE_EMULATOR)), + reason="emulator mode doesn't refresh channel", + ) @CrossSync.pytest async def test_channel_refresh(self, table_id, instance_id, temp_rows): """ diff --git a/tests/system/data/test_system_autogen.py b/tests/system/data/test_system_autogen.py index ede24be76..f9af614a2 100644 --- a/tests/system/data/test_system_autogen.py +++ b/tests/system/data/test_system_autogen.py @@ -165,6 +165,10 @@ def test_ping_and_warm(self, client, table): assert len(results) == 1 assert results[0] is None + @pytest.mark.skipif( + bool(os.environ.get(BIGTABLE_EMULATOR)), + reason="emulator mode doesn't refresh channel", + ) def test_channel_refresh(self, table_id, instance_id, temp_rows): """change grpc channel to refresh after 1 second. Schedule a read_rows call after refresh, to ensure new channel works"""