gapic-generator-python
gapic-generator-python copied to clipboard
Assertion error in generated unit tests for `x-goog-request-params` header
Affected APIs:
//google/cloud/run/v2/run_py_gapic_test
Failure example:
google/cloud/run/v2/run_py_gapic_srcjar.py/tests/unit/gapic/run_v2/test_revisions.py:1014: AssertionError
___________________________ test_list_services_pager ___________________________
transport_name = 'grpc'
def test_list_services_pager(transport_name: str = "grpc"):
client = ServicesClient(
credentials=ga_credentials.AnonymousCredentials,
transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.list_services),
'__call__') as call:
# Set the response to a series of pages.
call.side_effect = (
service.ListServicesResponse(
services=[
service.Service(),
service.Service(),
service.Service(),
],
next_page_token='abc',
),
service.ListServicesResponse(
services=[],
next_page_token='def',
),
service.ListServicesResponse(
services=[
service.Service(),
],
next_page_token='ghi',
),
service.ListServicesResponse(
services=[
service.Service(),
service.Service(),
],
),
RuntimeError,
)
metadata = ()
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((
('parent', ''),
)),
)
pager = client.list_services(request={})
> assert pager._metadata == metadata
E AssertionError: assert () == (('x-goog-req..., 'parent='),)
E Right contains one more item: ('x-goog-request-params', 'parent=')
E Use -v to get more diff
google/cloud/run/v2/run_py_gapic_srcjar.py/tests/unit/gapic/run_v2/test_services.py:1246: AssertionError
=========================== short test summary info ============================
FAILED google/cloud/run/v2/run_py_gapic_srcjar.py/tests/unit/gapic/run_v2/test_revisions.py::test_list_revisions_pager
FAILED google/cloud/run/v2/run_py_gapic_srcjar.py/tests/unit/gapic/run_v2/test_services.py::test_list_services_pager
2 failed, 276 passed, 81 warnings in 1.69s
The issue is not reproducible anymore. There were changes in run api itself, probably it got fixed by fixing proto definitions.
This is still happening if you have a URL parameter in a List call with an int64 type.
@SRabbelier please post error details and stacktrace if you have any.
Closing due to inactivity.
Reopening per @SRabbelier's internal request: this still seems to be happening.
@SRabbelier : can you post additional details. @vam-google said this was no longer happening. Where are you reproducing this?