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?
- Export the DATASTORE_EMULATOR_HOST environment variable set to the host and port of the running emulator in the test environment.Cevap
- BDeploy a dedicated Google Kubernetes Engine (GKE) cluster in the testing VPC to host containerized database mock instances for local developer execution.
- CAssign the primitive Owner IAM role to the test execution service account to bypass authentication requirements during local emulator requests.
- DGrant 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
Anahtar Kavram
Cloud Emulators Environment Configuration