Skip to content

Commit

Permalink
chore(tests): system tests support emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sanche committed Jan 18, 2024
1 parent f4ac54f commit 1590bee
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/system/data/setup_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,31 @@ def event_loop():
def instance_admin_client():
"""Client for interacting with the Instance Admin API."""
from google.cloud.bigtable_admin_v2 import BigtableInstanceAdminClient
from google.cloud.environment_vars import BIGTABLE_EMULATOR # type: ignore
import google.auth.credentials

with BigtableInstanceAdminClient() as client:
# check for emulator mode
credentials = None
if os.getenv(BIGTABLE_EMULATOR) is not None:
credentials = google.auth.credentials.AnonymousCredentials()

with BigtableInstanceAdminClient(credentials=credentials) as client:
yield client


@pytest.fixture(scope="session")
def table_admin_client():
"""Client for interacting with the Table Admin API."""
from google.cloud.bigtable_admin_v2 import BigtableTableAdminClient
from google.cloud.environment_vars import BIGTABLE_EMULATOR
import google.auth.credentials

# check for emulator mode
credentials = None
if os.getenv(BIGTABLE_EMULATOR) is not None:
credentials = google.auth.credentials.AnonymousCredentials()

with BigtableTableAdminClient() as client:
with BigtableTableAdminClient(credentials=credentials) as client:
yield client


Expand Down

0 comments on commit 1590bee

Please sign in to comment.