Question

Difficulty: HardCloud Emulators and Development Testing Frameworks

A software engineering team is constructing an automated local integration testing suite for an application that interacts with Cloud Bigtable. To run offline integration tests within an isolated CI container environment without network access to Google Cloud, the team starts the local emulator using `gcloud beta emulators bigtable start`. However, when test cases run, the application client library attempts to reach live Google Cloud endpoints and fails due to missing internet connectivity. Which configuration step must be performed so that the Cloud Bigtable client library routes requests directly to the locally running emulator process?

  1. Export the BIGTABLE_EMULATOR_HOST environment variable set to the host address and port where the emulator is running prior to executing the client application.Answer
  2. B
    Grant the primitive Owner role (roles/owner) to a local service account key file and reference it via standard Application Default Credentials.
  3. C
    Store the Bigtable schema and emulator data in an unversioned local directory and synchronize it to a Cloud Storage backend using Terraform prior to test execution.
  4. D
    Provision an isolated Google Kubernetes Engine (GKE) cluster in GCP for each test runner to host the Bigtable emulator container.

Answer

Export the BIGTABLE_EMULATOR_HOST environment variable set to the host address and port where the emulator is running prior to executing the client application.
The Cloud Bigtable emulator runs as a local process. Official GCP client SDKs look for the BIGTABLE_EMULATOR_HOST environment variable upon initialization. When present, the SDK sends API calls to the specified local port instead of authenticating with live Google Cloud end points.

Step-by-Step Solution

1
Identify how Google Cloud client libraries discover emulator endpoints.
Google Cloud client libraries automatically inspect environment variables (such as BIGTABLE_EMULATOR_HOST) to override default GCP service endpoints.
This allows offline local testing without modifying application code or making calls to live GCP APIs.
2
Configure the local test environment.
Set BIGTABLE_EMULATOR_HOST (e.g., BIGTABLE_EMULATOR_HOST=localhost:8086) in the shell or CI pipeline container running the tests.
The client SDK redirects all database reads and writes to the local Bigtable emulator process running on that socket.

Key Concept

Cloud Bigtable Emulator Host Environment Variable Configuration
Rate this question