Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 3648d70

Browse files
test: Use latest conformance test version and exclude unsupported features (#1149)
1 parent 7a91bbf commit 3648d70

5 files changed

Lines changed: 55 additions & 29 deletions

File tree

.github/workflows/conformance.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,15 @@ jobs:
2424
runs-on: ubuntu-latest
2525
strategy:
2626
matrix:
27-
test-version: [ "v0.0.2" ]
27+
test-version: [ "v0.0.4" ]
2828
py-version: [ 3.8 ]
29-
client-type: [ "async", "sync", "legacy" ]
29+
client-type: [ "async", "sync"]
30+
# None of the clients currently support reverse scans, execute query plan refresh, retry info, or routing cookie
3031
include:
32+
- client-type: "async"
33+
test_args: "-skip \"PlanRefresh|_Reverse|_WithRetryInfo|_WithRoutingCookie\""
3134
- client-type: "sync"
32-
# sync client does not support concurrent streams
33-
test_args: "-skip _Generic_MultiStream"
34-
- client-type: "legacy"
35-
# legacy client is synchronous and does not support concurrent streams
36-
# legacy client does not expose mutate_row. Disable those tests
37-
test_args: "-skip _Generic_MultiStream -skip TestMutateRow_"
35+
test_args: "-skip \"PlanRefresh|_Reverse|_WithRetryInfo|_WithRoutingCookie|_Generic_MultiStream\""
3836
fail-fast: false
3937
name: "${{ matrix.client-type }} client / python ${{ matrix.py-version }} / test tag ${{ matrix.test-version }}"
4038
steps:

google/cloud/bigtable/data/exceptions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ def __init__(
331331
class InvalidExecuteQueryResponse(core_exceptions.GoogleAPICallError):
332332
"""Exception raised to invalid query response data from back-end."""
333333

334+
# Set to internal. This is representative of an internal error.
335+
code = 13
336+
334337

335338
class ParameterTypeInferenceFailed(ValueError):
336339
"""Exception raised when query parameter types were not provided and cannot be inferred."""

test_proxy/handlers/client_handler_data_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ async def ExecuteQuery(self, request, **kwargs):
276276
prepare_operation_timeout=operation_timeout,
277277
)
278278
)
279-
rows = [r async for r in result]
279+
rows = CrossSync.rm_aio([r async for r in result])
280280
md = result.metadata
281281
proto_rows = []
282282
for r in rows:

test_proxy/handlers/client_handler_data_sync_autogen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ async def ExecuteQuery(self, request, **kwargs):
205205
operation_timeout=operation_timeout,
206206
prepare_operation_timeout=operation_timeout,
207207
)
208-
rows = [r async for r in result]
208+
rows = [r for r in result]
209209
md = result.metadata
210210
proto_rows = []
211211
for r in rows:

test_proxy/handlers/grpc_handler.py

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@
88
from google.protobuf import json_format
99

1010

11+
def correct_cancelled(status):
12+
"""
13+
Deadline exceeded errors are a race between client side cancellation and server
14+
side deadline exceeded. For the purpose of these tests, the client will never cancel,
15+
so we adjust cancelled errors to deadline_exceeded for consistency.
16+
"""
17+
if status.code == 1:
18+
return Status(code=4, message="deadlineexceeded")
19+
return status
20+
21+
1122
class TestProxyGrpcServer(test_proxy_pb2_grpc.CloudBigtableV2TestProxyServicer):
1223
"""
1324
Implements a grpc server that proxies conformance test requests to the client library
@@ -75,7 +86,7 @@ def ReadRows(self, request, context, client_response=None):
7586
status = Status()
7687
rows = []
7788
if isinstance(client_response, dict) and "error" in client_response:
78-
status = Status(code=5, message=client_response["error"])
89+
status = correct_cancelled(Status(code=5, message=client_response["error"]))
7990
else:
8091
rows = [data_pb2.Row(**d) for d in client_response]
8192
result = test_proxy_pb2.RowsResult(rows=rows, status=status)
@@ -86,9 +97,11 @@ def ReadRow(self, request, context, client_response=None):
8697
status = Status()
8798
row = None
8899
if isinstance(client_response, dict) and "error" in client_response:
89-
status = Status(
90-
code=client_response.get("code", 5),
91-
message=client_response.get("error"),
100+
status = correct_cancelled(
101+
Status(
102+
code=client_response.get("code", 5),
103+
message=client_response.get("error"),
104+
)
92105
)
93106
elif client_response != "None":
94107
row = data_pb2.Row(**client_response)
@@ -99,8 +112,11 @@ def ReadRow(self, request, context, client_response=None):
99112
def MutateRow(self, request, context, client_response=None):
100113
status = Status()
101114
if isinstance(client_response, dict) and "error" in client_response:
102-
status = Status(
103-
code=client_response.get("code", 5), message=client_response["error"]
115+
status = correct_cancelled(
116+
Status(
117+
code=client_response.get("code", 5),
118+
message=client_response["error"],
119+
)
104120
)
105121
return test_proxy_pb2.MutateRowResult(status=status)
106122

@@ -112,24 +128,27 @@ def BulkMutateRows(self, request, context, client_response=None):
112128
entries = [
113129
bigtable_pb2.MutateRowsResponse.Entry(
114130
index=exc_dict.get("index", 1),
115-
status=Status(code=exc_dict.get("code", 5)),
131+
status=correct_cancelled(Status(code=exc_dict.get("code", 5))),
116132
)
117133
for exc_dict in client_response.get("subexceptions", [])
118134
]
119-
if not entries:
120-
# only return failure on the overall request if there are failed entries
121-
status = Status(
135+
status = correct_cancelled(
136+
Status(
122137
code=client_response.get("code", 5),
123138
message=client_response["error"],
124139
)
140+
)
125141
response = test_proxy_pb2.MutateRowsResult(status=status, entries=entries)
126142
return response
127143

128144
@delegate_to_client_handler
129145
def CheckAndMutateRow(self, request, context, client_response=None):
130146
if isinstance(client_response, dict) and "error" in client_response:
131-
status = Status(
132-
code=client_response.get("code", 5), message=client_response["error"]
147+
status = correct_cancelled(
148+
Status(
149+
code=client_response.get("code", 5),
150+
message=client_response["error"],
151+
)
133152
)
134153
response = test_proxy_pb2.CheckAndMutateRowResult(status=status)
135154
else:
@@ -146,9 +165,11 @@ def ReadModifyWriteRow(self, request, context, client_response=None):
146165
status = Status()
147166
row = None
148167
if isinstance(client_response, dict) and "error" in client_response:
149-
status = Status(
150-
code=client_response.get("code", 5),
151-
message=client_response.get("error"),
168+
status = correct_cancelled(
169+
Status(
170+
code=client_response.get("code", 5),
171+
message=client_response.get("error"),
172+
)
152173
)
153174
elif client_response != "None":
154175
row = data_pb2.Row(**client_response)
@@ -160,9 +181,11 @@ def SampleRowKeys(self, request, context, client_response=None):
160181
status = Status()
161182
sample_list = []
162183
if isinstance(client_response, dict) and "error" in client_response:
163-
status = Status(
164-
code=client_response.get("code", 5),
165-
message=client_response.get("error"),
184+
status = correct_cancelled(
185+
Status(
186+
code=client_response.get("code", 5),
187+
message=client_response.get("error"),
188+
)
166189
)
167190
else:
168191
for sample in client_response:
@@ -177,7 +200,9 @@ def SampleRowKeys(self, request, context, client_response=None):
177200
def ExecuteQuery(self, request, context, client_response=None):
178201
if isinstance(client_response, dict) and "error" in client_response:
179202
return test_proxy_pb2.ExecuteQueryResult(
180-
status=Status(code=13, message=client_response["error"])
203+
status=correct_cancelled(
204+
Status(code=client_response.get("code", 13), message=client_response["error"])
205+
)
181206
)
182207
else:
183208
return test_proxy_pb2.ExecuteQueryResult(

0 commit comments

Comments
 (0)