Soru

Zorluk: OrtaCloud Emulators and Development Testing Frameworks

A site reliability engineering team is establishing an automated local integration testing harness for a microservice that queries Cloud Datastore. To run offline tests without making calls to live Google Cloud endpoints or requiring JSON service account keys, the team starts the Datastore emulator using the gcloud CLI. Which action must the team take to ensure the microservice client library automatically redirects database calls to the running local emulator?

  1. Export the DATASTORE_EMULATOR_HOST environment variable set to the host and port of the running emulator in the test environment.Cevap
  2. B
    Deploy a dedicated Google Kubernetes Engine (GKE) cluster in the testing VPC to host containerized database mock instances for local developer execution.
  3. C
    Assign the primitive Owner IAM role to the test execution service account to bypass authentication requirements during local emulator requests.
  4. D
    Grant the test runner container the Service Account Admin role (roles/iam.serviceAccountAdmin) to dynamically issue self-signed key pairs for the emulator.

Cevap

Export the DATASTORE_EMULATOR_HOST environment variable set to the host and port of the running emulator in the test environment.
Exporting the DATASTORE_EMULATOR_HOST environment variable instructs official Google Cloud client libraries to bypass default GCP endpoints and route calls directly to the specified local emulator address without requiring authentication or live cloud infrastructure.

Adım Adım Çözüm

1
Identify the standard mechanism used by Google Cloud Client Libraries to locate local service emulators.
GCP SDK client libraries automatically inspect specific environment variables (e.g., DATASTORE_EMULATOR_HOST, PUBSUB_EMULATOR_HOST) upon initialization.
Setting these environment variables overrides the default production Google Cloud API endpoints and disables external authentication requirements.
2
Evaluate the configuration requirements for offline test execution.
Setting DATASTORE_EMULATOR_HOST allows application code to run completely offline without code changes or service account key management.
This establishes a lightweight, isolated local integration testing framework suited for CI/CD runners and local development.

Anahtar Kavram

Cloud Emulators Environment Configuration
Bu soruyu puanla