From eac9e2c168fe666dce9a8e2457f1abe4725e3e84 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 18 Jul 2025 14:39:41 -0700 Subject: [PATCH 1/2] fix ci --- tests/system/data/test_system_async.py | 18 ++++++++++++++---- tests/system/data/test_system_autogen.py | 16 ++++++++++++---- tests/unit/data/test_mutations.py | 12 ++++++++++++ 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/tests/system/data/test_system_async.py b/tests/system/data/test_system_async.py index 6747a73e0..9f79916fb 100644 --- a/tests/system/data/test_system_async.py +++ b/tests/system/data/test_system_async.py @@ -1185,7 +1185,7 @@ async def test_execute_query_simple(self, client, table_id, instance_id): predicate=retry.if_exception_type(ClientError), initial=1, maximum=5 ) async def test_execute_against_target( - self, client, instance_id, table_id, temp_rows + self, client, instance_id, table_id, temp_rows, column_family_config ): await temp_rows.add_row(b"row_key_1") result = await client.execute_query( @@ -1200,7 +1200,9 @@ async def test_execute_against_target( assert family_map[b"q"] == b"test-value" assert len(rows[0][TEST_FAMILY_2]) == 0 md = result.metadata - assert len(md) == 3 + # we expect it to fetch each column family, plus _key + # add additional families here if column_family_config changes + assert len(md) == len(column_family_config) + 1 assert md["_key"].column_type == SqlType.Bytes() assert md[TEST_FAMILY].column_type == SqlType.Map( SqlType.Bytes(), SqlType.Bytes() @@ -1208,6 +1210,9 @@ async def test_execute_against_target( assert md[TEST_FAMILY_2].column_type == SqlType.Map( SqlType.Bytes(), SqlType.Bytes() ) + assert md[TEST_AGGREGATE_FAMILY].column_type == SqlType.Map( + SqlType.Bytes(), SqlType.Int64() + ) @pytest.mark.skipif( bool(os.environ.get(BIGTABLE_EMULATOR)), @@ -1310,7 +1315,7 @@ async def test_execute_query_params(self, client, table_id, instance_id): predicate=retry.if_exception_type(ClientError), initial=1, maximum=5 ) async def test_execute_metadata_on_empty_response( - self, client, instance_id, table_id, temp_rows + self, client, instance_id, table_id, temp_rows, column_family_config ): await temp_rows.add_row(b"row_key_1") result = await client.execute_query( @@ -1320,7 +1325,9 @@ async def test_execute_metadata_on_empty_response( assert len(rows) == 0 md = result.metadata - assert len(md) == 3 + # we expect it to fetch each column family, plus _key + # add additional families here if column_family_config change + assert len(md) == len(column_family_config) + 1 assert md["_key"].column_type == SqlType.Bytes() assert md[TEST_FAMILY].column_type == SqlType.Map( SqlType.Bytes(), SqlType.Bytes() @@ -1328,3 +1335,6 @@ async def test_execute_metadata_on_empty_response( assert md[TEST_FAMILY_2].column_type == SqlType.Map( SqlType.Bytes(), SqlType.Bytes() ) + assert md[TEST_AGGREGATE_FAMILY].column_type == SqlType.Map( + SqlType.Bytes(), SqlType.Int64() + ) \ No newline at end of file diff --git a/tests/system/data/test_system_autogen.py b/tests/system/data/test_system_autogen.py index d5ad9156f..46e9c2215 100644 --- a/tests/system/data/test_system_autogen.py +++ b/tests/system/data/test_system_autogen.py @@ -966,7 +966,9 @@ def test_execute_query_simple(self, client, table_id, instance_id): @CrossSync._Sync_Impl.Retry( predicate=retry.if_exception_type(ClientError), initial=1, maximum=5 ) - def test_execute_against_target(self, client, instance_id, table_id, temp_rows): + def test_execute_against_target( + self, client, instance_id, table_id, temp_rows, column_family_config + ): temp_rows.add_row(b"row_key_1") result = client.execute_query("SELECT * FROM `" + table_id + "`", instance_id) rows = [r for r in result] @@ -977,7 +979,7 @@ def test_execute_against_target(self, client, instance_id, table_id, temp_rows): assert family_map[b"q"] == b"test-value" assert len(rows[0][TEST_FAMILY_2]) == 0 md = result.metadata - assert len(md) == 3 + assert len(md) == len(column_family_config) + 1 assert md["_key"].column_type == SqlType.Bytes() assert md[TEST_FAMILY].column_type == SqlType.Map( SqlType.Bytes(), SqlType.Bytes() @@ -985,6 +987,9 @@ def test_execute_against_target(self, client, instance_id, table_id, temp_rows): assert md[TEST_FAMILY_2].column_type == SqlType.Map( SqlType.Bytes(), SqlType.Bytes() ) + assert md[TEST_AGGREGATE_FAMILY].column_type == SqlType.Map( + SqlType.Bytes(), SqlType.Int64() + ) @pytest.mark.skipif( bool(os.environ.get(BIGTABLE_EMULATOR)), reason="emulator doesn't support SQL" @@ -1074,7 +1079,7 @@ def test_execute_query_params(self, client, table_id, instance_id): predicate=retry.if_exception_type(ClientError), initial=1, maximum=5 ) def test_execute_metadata_on_empty_response( - self, client, instance_id, table_id, temp_rows + self, client, instance_id, table_id, temp_rows, column_family_config ): temp_rows.add_row(b"row_key_1") result = client.execute_query( @@ -1083,7 +1088,7 @@ def test_execute_metadata_on_empty_response( rows = [r for r in result] assert len(rows) == 0 md = result.metadata - assert len(md) == 3 + assert len(md) == len(column_family_config) + 1 assert md["_key"].column_type == SqlType.Bytes() assert md[TEST_FAMILY].column_type == SqlType.Map( SqlType.Bytes(), SqlType.Bytes() @@ -1091,3 +1096,6 @@ def test_execute_metadata_on_empty_response( assert md[TEST_FAMILY_2].column_type == SqlType.Map( SqlType.Bytes(), SqlType.Bytes() ) + assert md[TEST_AGGREGATE_FAMILY].column_type == SqlType.Map( + SqlType.Bytes(), SqlType.Int64() + ) diff --git a/tests/unit/data/test_mutations.py b/tests/unit/data/test_mutations.py index ac1c8bd6b..17050162c 100644 --- a/tests/unit/data/test_mutations.py +++ b/tests/unit/data/test_mutations.py @@ -117,6 +117,17 @@ def test_size(self, test_dict): {"delete_from_family": {"family_name": "foo"}}, ), (mutations.DeleteAllFromRow, {"delete_from_row": {}}), + ( + mutations.AddToCell, + { + "add_to_cell": { + "family_name": "foo", + "column_qualifier": {"raw_value": b"bar"}, + "timestamp": {"raw_timestamp_micros": 12345}, + "input": {"int_value": 123}, + } + }, + ), ], ) def test__from_dict(self, expected_class, input_dict): @@ -162,6 +173,7 @@ def test__from_dict_wrong_subclass(self): mutations.DeleteRangeFromColumn("foo", b"bar"), mutations.DeleteAllFromFamily("foo"), mutations.DeleteAllFromRow(), + mutations.AddToCell("foo", b"bar", 123, 456), ] for instance in subclasses: others = [other for other in subclasses if other != instance] From 681abd5090b7b2939d950666d2f450a8a1b7c739 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 18 Jul 2025 14:41:38 -0700 Subject: [PATCH 2/2] fix lint --- tests/system/data/test_system_async.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/data/test_system_async.py b/tests/system/data/test_system_async.py index 9f79916fb..0dd6e8100 100644 --- a/tests/system/data/test_system_async.py +++ b/tests/system/data/test_system_async.py @@ -1337,4 +1337,4 @@ async def test_execute_metadata_on_empty_response( ) assert md[TEST_AGGREGATE_FAMILY].column_type == SqlType.Map( SqlType.Bytes(), SqlType.Int64() - ) \ No newline at end of file + )