Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Requiring trailing_metadata is a breaking change #297

Closed
@tseaver

Description

@tseaver

PR #286 added support for showing error status details -- unfortunately, it also breaks Bigtable's unit tests:

___ Test_retry_read_rows_exception.test_w_deadline_exceeded_wrapped_in_grpc ____

self = <tests.unit.test_row_data.Test_retry_read_rows_exception testMethod=test_w_deadline_exceeded_wrapped_in_grpc>

    def test_w_deadline_exceeded_wrapped_in_grpc(self):
        from google.api_core.exceptions import DeadlineExceeded

        wrapped = DeadlineExceeded("testing")
        exception = self._make_grpc_call_error(wrapped)
>       self.assertTrue(self._call_fut(exception))

tests/unit/test_row_data.py:324:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/unit/test_row_data.py:268: in _call_fut
    return _retry_read_rows_exception(exc)
google/cloud/bigtable/row_data.py:333: in _retry_read_rows_exception
    exc = exceptions.from_grpc_error(exc)
.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/exceptions.py:537: in from_grpc_error
    details=_parse_grpc_error_details(rpc_exc),
.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/exceptions.py:490: in _parse_grpc_error_details
    status = rpc_status.from_call(rpc_exc)
.nox/unit-3-9/lib/python3.9/site-packages/grpc_status/rpc_status.py:48: in from_call
    if call.trailing_metadata() is None:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = TestingException(DeadlineExceeded('testing'))

    @abc.abstractmethod
    def trailing_metadata(self):
        """Accesses the trailing metadata sent by the server.

        This method blocks until the value is available.

        Returns:
          The trailing :term:`metadata`.
        """
>       raise NotImplementedError()
E       NotImplementedError

.nox/unit-3-9/lib/python3.9/site-packages/grpc/__init__.py:382: NotImplementedError
__________ Test_retry_read_rows_exception.test_w_miss_wrapped_in_grpc __________

self = <tests.unit.test_row_data.Test_retry_read_rows_exception testMethod=test_w_miss_wrapped_in_grpc>

    def test_w_miss_wrapped_in_grpc(self):
        from google.api_core.exceptions import Conflict

        wrapped = Conflict("testing")
        exception = self._make_grpc_call_error(wrapped)
>       self.assertFalse(self._call_fut(exception))

tests/unit/test_row_data.py:310:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/unit/test_row_data.py:268: in _call_fut
    return _retry_read_rows_exception(exc)
google/cloud/bigtable/row_data.py:333: in _retry_read_rows_exception
    exc = exceptions.from_grpc_error(exc)
.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/exceptions.py:537: in from_grpc_error
    details=_parse_grpc_error_details(rpc_exc),
.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/exceptions.py:490: in _parse_grpc_error_details
    status = rpc_status.from_call(rpc_exc)
.nox/unit-3-9/lib/python3.9/site-packages/grpc_status/rpc_status.py:48: in from_call
    if call.trailing_metadata() is None:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = TestingException(Conflict('testing'))

    @abc.abstractmethod
    def trailing_metadata(self):
        """Accesses the trailing metadata sent by the server.

        This method blocks until the value is available.

        Returns:
          The trailing :term:`metadata`.
        """
>       raise NotImplementedError()
E       NotImplementedError

.nox/unit-3-9/lib/python3.9/site-packages/grpc/__init__.py:382: NotImplementedError
__ Test_retry_read_rows_exception.test_w_service_unavailable_wrapped_in_grpc ___

self = <tests.unit.test_row_data.Test_retry_read_rows_exception testMethod=test_w_service_unavailable_wrapped_in_grpc>

    def test_w_service_unavailable_wrapped_in_grpc(self):
        from google.api_core.exceptions import ServiceUnavailable

        wrapped = ServiceUnavailable("testing")
        exception = self._make_grpc_call_error(wrapped)
>       self.assertTrue(self._call_fut(exception))

tests/unit/test_row_data.py:317:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/unit/test_row_data.py:268: in _call_fut
    return _retry_read_rows_exception(exc)
google/cloud/bigtable/row_data.py:333: in _retry_read_rows_exception
    exc = exceptions.from_grpc_error(exc)
.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/exceptions.py:537: in from_grpc_error
    details=_parse_grpc_error_details(rpc_exc),
.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/exceptions.py:490: in _parse_grpc_error_details
    status = rpc_status.from_call(rpc_exc)
.nox/unit-3-9/lib/python3.9/site-packages/grpc_status/rpc_status.py:48: in from_call
    if call.trailing_metadata() is None:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = TestingException(ServiceUnavailable('testing'))

    @abc.abstractmethod
    def trailing_metadata(self):
        """Accesses the trailing metadata sent by the server.

        This method blocks until the value is available.

        Returns:
          The trailing :term:`metadata`.
        """
>       raise NotImplementedError()
E       NotImplementedError

.nox/unit-3-9/lib/python3.9/site-packages/grpc/__init__.py:382: NotImplementedError

Metadata

Metadata

Assignees

Labels

priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions