Soru

Zorluk: Çok zorCloud Emulators and Development Testing Frameworks

A cloud architecture team is refactoring an event-driven data pipeline that processes real-time transaction events via Cloud Pub/Sub and persists aggregated records into Cloud Bigtable. To cut cloud costs and accelerate CI/CD build execution, the team must run unit and integration tests completely offline without interacting with real Google Cloud API endpoints. Which TWO configuration steps must be implemented to ensure the client SDKs route all network requests to the locally running emulators? (Select TWO.)

  1. Export the environment variable PUBSUB_EMULATOR_HOST set to the host and port of the running Pub/Sub emulator before initializing the application client.Cevap
  2. B
    Grant the roles/owner primitive IAM role to the local emulator container's service account to bypass Cloud IAM API authentication during test execution.
  3. Export the environment variable BIGTABLE_EMULATOR_HOST pointing to the socket of the local Bigtable emulator prior to invoking the test runner.Cevap
  4. D
    Provision an isolated Google Kubernetes Engine (GKE) cluster in a development GCP project to run emulator containers for each CI build stage.

Cevap

To route client SDK requests to local emulators offline, developers must export the PUBSUB_EMULATOR_HOST environment variable for Cloud Pub/Sub and the BIGTABLE_EMULATOR_HOST environment variable for Cloud Bigtable.
Google Cloud client SDKs for Cloud Pub/Sub and Cloud Bigtable automatically detect the PUBSUB_EMULATOR_HOST and BIGTABLE_EMULATOR_HOST environment variables. When set, client libraries automatically redirect API calls to local emulator sockets and disable network calls to production Google Cloud endpoints.

Adım Adım Çözüm

1
Identify the standard host environment variables defined by Google Cloud Client Libraries for service emulators.
PUBSUB_EMULATOR_HOST and BIGTABLE_EMULATOR_HOST are recognized automatically by GCP client libraries.
When these environment variables are populated with host:port values, client SDKs override default Google service endpoints and direct traffic to local emulator sockets.
2
Evaluate local emulator execution requirements against live GCP infrastructure provisioning.
Local environment variables allow completely offline, cost-free, high-speed test execution.
Emulators do not require active Cloud IAM roles, live service account credentials, or provisioned GKE compute clusters.

Anahtar Kavram

Google Cloud Client Library emulator auto-discovery via host environment variables
Bu soruyu puanla