Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions google/cloud/bigtable/admin_v2/overlay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
# client class under overlay/services.

from .types import (
AsyncRestoreTableOperation,
RestoreTableOperation,
WaitForConsistencyRequest,
)

from .services.bigtable_table_admin import (
Expand All @@ -39,7 +41,9 @@
)

__all__ = (
"AsyncRestoreTableOperation",
"RestoreTableOperation",
"BigtableTableAdminAsyncClient",
"BigtableTableAdminClient",
"WaitForConsistencyRequest",
)
5 changes: 5 additions & 0 deletions google/cloud/bigtable/admin_v2/overlay/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .async_restore_table import (
AsyncRestoreTableOperation,
)

from .restore_table import (
RestoreTableOperation,
)
Expand All @@ -21,6 +25,7 @@
)

__all__ = (
"AsyncRestoreTableOperation",
"RestoreTableOperation",
"WaitForConsistencyRequest",
)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
OptionalRetry = Union[retries.Retry, object, None] # type: ignore


# The consistency check could take a very long time, so we wait indefinitely.
DEFAULT_RETRY = async_future.DEFAULT_RETRY.with_timeout(None)


class _AsyncCheckConsistencyPollingFuture(async_future.AsyncFuture):
"""A Future that polls an underlying `check_consistency` operation until it returns True.

Expand All @@ -48,7 +52,7 @@ class _AsyncCheckConsistencyPollingFuture(async_future.AsyncFuture):
<google.cloud.bigtable.admin_v2.overlay.services.bigtable_table_admin.BigtableTableAdminClient.wait_for_consistency>`
or :meth:`wait_for_replication
<google.cloud.bigtable.admin_v2.overlay.services.bigtable_table_admin.BigtableTableAdminClient.wait_for_replication>`
retry (google.api_core.retry.Retry): The retry configuration used
retry (google.api_core.retry.AsyncRetry): The retry configuration used
when polling. This can be used to control how often :meth:`done`
is polled. Regardless of the retry's ``deadline``, it will be
overridden by the ``timeout`` argument to :meth:`result`.
Expand All @@ -59,7 +63,7 @@ def __init__(
check_consistency_call: Callable[
[OptionalRetry], Awaitable[bigtable_table_admin.CheckConsistencyResponse]
],
retry: retries.Retry = async_future.DEFAULT_RETRY,
retry: retries.AsyncRetry = DEFAULT_RETRY,
**kwargs
):
super(_AsyncCheckConsistencyPollingFuture, self).__init__(retry=retry, **kwargs)
Expand Down
6 changes: 5 additions & 1 deletion google/cloud/bigtable/admin_v2/overlay/types/consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
OptionalRetry = Union[retries.Retry, object, None] # type: ignore


# The consistency check could take a very long time, so we wait indefinitely.
DEFAULT_RETRY = polling.DEFAULT_POLLING.with_timeout(None)


class _CheckConsistencyPollingFuture(polling.PollingFuture):
"""A Future that polls an underlying `check_consistency` operation until it returns True.

Expand Down Expand Up @@ -55,7 +59,7 @@ def __init__(
check_consistency_call: Callable[
[OptionalRetry], bigtable_table_admin.CheckConsistencyResponse
],
polling: retries.Retry = polling.DEFAULT_POLLING,
polling: retries.Retry = DEFAULT_RETRY,
**kwargs
):
super(_CheckConsistencyPollingFuture, self).__init__(polling=polling, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# 'Development Status :: 5 - Production/Stable'
release_status = "Development Status :: 5 - Production/Stable"
dependencies = [
"google-api-core[grpc] >= 2.16.0, <3.0.0",
"google-api-core[grpc] >= 2.17.0, <3.0.0",
"google-cloud-core >= 1.4.4, <3.0.0",
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
"grpc-google-iam-v1 >= 0.12.4, <1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion testing/constraints-3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
# Then this file should have foo==1.14.0
google-api-core==2.16.0
google-api-core==2.17.0
google-auth==2.14.1
google-cloud-core==2.0.0
grpc-google-iam-v1==0.12.4
Expand Down
2 changes: 1 addition & 1 deletion testing/constraints-3.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
# Then this file should have foo==1.14.0
google-api-core==2.16.0
google-api-core==2.17.0
google-auth==2.14.1
google-cloud-core==2.0.0
grpc-google-iam-v1==0.12.4
Expand Down
Empty file.
36 changes: 36 additions & 0 deletions tests/system/admin_overlay/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import google.auth

import os
import pytest
import uuid


INSTANCE_PREFIX = "admin-overlay-instance"
BACKUP_PREFIX = "admin-overlay-backup"
ROW_PREFIX = "test-row"

DEFAULT_CLUSTER_LOCATIONS = ["us-east1-b"]
REPLICATION_CLUSTER_LOCATIONS = ["us-east1-b", "us-west1-b"]
TEST_TABLE_NAME = "system-test-table"
TEST_BACKUP_TABLE_NAME = "system-test-backup-table"
TEST_COLUMMN_FAMILY_NAME = "test-column"
TEST_COLUMN_NAME = "value"
NUM_ROWS = 500
INITIAL_CELL_VALUE = "Hello"
NEW_CELL_VALUE = "World"


@pytest.fixture(scope="session")
def admin_overlay_project_id():
_, default_project = google.auth.default()
yield os.getenv("ADMIN_TEST_PROJECT") or default_project

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should check for GOOGLE_CLOUD_PROJECT, since that's the standard (and is used in the data client)

If you want, you can check for both, but if AMIN_TEST_PROJECT isn't set, it should fall back to the standard one



def generate_unique_suffix(name):
"""
Generates a unique suffix for the name.

Uses UUID4 because using time.time doesn't guarantee
uniqueness when the time is frozen in containers.
"""
return f"{name}-{uuid.uuid4().hex[:7]}"
Loading
Loading