Navigation Menu

Skip to content

Commit

Permalink
Revert "test: unskip list_backup_operations sample test (#170)" (#174)
Browse files Browse the repository at this point in the history
This reverts commit 864f09c.
  • Loading branch information
larkee committed Nov 24, 2020
1 parent d59d502 commit 6053f4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
19 changes: 2 additions & 17 deletions google/cloud/spanner_v1/instance.py
Expand Up @@ -14,7 +14,6 @@

"""User friendly container for Cloud Spanner Instance."""

import google.api_core.operation
import re

from google.cloud.spanner_admin_instance_v1 import Instance as InstancePB
Expand Down Expand Up @@ -466,7 +465,7 @@ def list_backup_operations(self, filter_="", page_size=None):
page_iter = self._client.database_admin_api.list_backup_operations(
request=request, metadata=metadata
)
return map(self._item_to_operation, page_iter)
return page_iter

def list_database_operations(self, filter_="", page_size=None):
"""List database operations for the instance.
Expand Down Expand Up @@ -494,18 +493,4 @@ def list_database_operations(self, filter_="", page_size=None):
page_iter = self._client.database_admin_api.list_database_operations(
request=request, metadata=metadata
)
return map(self._item_to_operation, page_iter)

def _item_to_operation(self, operation_pb):
"""Convert an operation protobuf to the native object.
:type operation_pb: :class:`~google.longrunning.operations.Operation`
:param operation_pb: An operation returned from the API.
:rtype: :class:`~google.api_core.operation.Operation`
:returns: The next operation in the page.
"""
operations_client = self._client.database_admin_api.transport.operations_client
metadata_type = _type_string_to_type_pb(operation_pb.metadata.type_url)
response_type = _OPERATION_RESPONSE_TYPES[metadata_type]
return google.api_core.operation.from_gapic(
operation_pb, operations_client, response_type, metadata_type=metadata_type
)
return page_iter
6 changes: 6 additions & 0 deletions samples/samples/backup_sample_test.py
Expand Up @@ -79,6 +79,12 @@ def test_restore_database(capsys):
assert BACKUP_ID in out


@pytest.mark.skip(
reason=(
"failing due to a production bug"
"https://github.com/googleapis/python-spanner/issues/149"
)
)
def test_list_backup_operations(capsys, spanner_instance):
backup_sample.list_backup_operations(INSTANCE_ID, DATABASE_ID)
out, _ = capsys.readouterr()
Expand Down

0 comments on commit 6053f4a

Please sign in to comment.