googleapis / python-spanner

Apache License 2.0
135 stars 85 forks source link

prerelease-dependencies build failures on autogenerated tests #1098

Open harshachinta opened 7 months ago

harshachinta commented 7 months ago

prerelease-dependencies presubmits and continuous build failing with below error, Fusion link

These failure are happening on the autogenerated tests.

________________________ test_list_instances_rest[dict] ________________________

request_type = <class 'dict'>

    @pytest.mark.parametrize(
        "request_type",
        [
            spanner_instance_admin.ListInstancesRequest,
            dict,
        ],
    )
    def test_list_instances_rest(request_type):
        client = InstanceAdminClient(
            credentials=ga_credentials.AnonymousCredentials(),
            transport="rest",
        )

        # send a request that will satisfy transcoding
        request_init = {"parent": "projects/sample1"}
        request = request_type(**request_init)

        # Mock the http request call within the method and fake a response.
        with mock.patch.object(type(client.transport._session), "request") as req:
            # Designate an appropriate value for the returned response.
            return_value = spanner_instance_admin.ListInstancesResponse(
                next_page_token="next_page_token_value",
            )

            # Wrap the value into a proper Response obj
            response_value = Response()
            response_value.status_code = 200
            # Convert return value to protobuf type
            return_value = spanner_instance_admin.ListInstancesResponse.pb(return_value)
            json_return_value = json_format.MessageToJson(return_value)

            response_value._content = json_return_value.encode("UTF-8")
            req.return_value = response_value
>           response = client.list_instances(request)

[tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py:6677](https://cs.corp.google.com/piper///depot/google3/tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py?l=6677): 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py:1429](https://cs.corp.google.com/piper///depot/google3/google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py?l=1429): in list_instances
    response = rpc(
[.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py:131](https://cs.corp.google.com/piper///depot/google3/.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py?l=131): in __call__
    return wrapped_func(*args, **kwargs)
[.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/retry/retry_unary.py:293](https://cs.corp.google.com/piper///depot/google3/.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/retry/retry_unary.py?l=293): in retry_wrapped_func
    return retry_target(
[.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/retry/retry_unary.py:153](https://cs.corp.google.com/piper///depot/google3/.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/retry/retry_unary.py?l=153): in retry_target
    _retry_error_helper(
[.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/retry/retry_base.py:212](https://cs.corp.google.com/piper///depot/google3/.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/retry/retry_base.py?l=212): in _retry_error_helper
    raise final_exc from source_exc
[.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/retry/retry_unary.py:144](https://cs.corp.google.com/piper///depot/google3/.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/retry/retry_unary.py?l=144): in retry_target
    result = target()
[.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/timeout.py:120](https://cs.corp.google.com/piper///depot/google3/.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/timeout.py?l=120): in func_with_timeout
    return func(*args, **kwargs)
[.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/grpc_helpers.py:76](https://cs.corp.google.com/piper///depot/google3/.nox/prerelease_deps-3-8-database_dialect-postgresql/lib/python3.8/site-packages/google/api_core/grpc_helpers.py?l=76): in error_remapped_callable
    return callable_(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = InstanceAdminRestTransport._ListInstances(_session=<google.auth.transport.requests.AuthorizedSession object at 0x7fc1f...anner_admin_instance_v1.services.instance_admin.transports.rest.InstanceAdminRestInterceptor object at 0x7fc1fbe3a790>)
request = parent: "projects/sample1"

    def __call__(
        self,
        request: spanner_instance_admin.ListInstancesRequest,
        *,
        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Optional[float] = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> spanner_instance_admin.ListInstancesResponse:
        r"""Call the list instances method over HTTP.

        Args:
            request (~.spanner_instance_admin.ListInstancesRequest):
                The request object. The request for
            [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances].
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            ~.spanner_instance_admin.ListInstancesResponse:
                The response for
            [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances].

        """

        http_options: List[Dict[str, str]] = [
            {
                "method": "get",
                "uri": "/v1/{parent=projects/*}/instances",
            },
        ]
        request, metadata = self._interceptor.pre_list_instances(request, metadata)
        pb_request = spanner_instance_admin.ListInstancesRequest.pb(request)
        transcoded_request = path_template.transcode(http_options, pb_request)

        uri = transcoded_request["uri"]
        method = transcoded_request["method"]

        # Jsonify the query params
        query_params = json.loads(
>           json_format.MessageToJson(
                transcoded_request["query_params"],
                including_default_value_fields=False,
                use_integers_for_enums=True,
            )
        )
E       TypeError: MessageToJson() got an unexpected keyword argument 'including_default_value_fields'

[google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest.py:1628](https://cs.corp.google.com/piper///depot/google3/google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/rest.py?l=1628): TypeError
harshachinta commented 7 months ago

@parthea Any idea on why is it failing? This file doesn't seem to be updated recently but we are seeing this failures from last 2 builds.

harshachinta commented 7 months ago

This issue is tracked here https://github.com/googleapis/proto-plus-python/issues/431 https://github.com/googleapis/gapic-generator-python/issues/1935