An application development team is establishing an automated local integration testing suite for a microservice that reads and writes documents using Cloud Datastore / Firestore in Native mode. To prevent test suites from interacting with live production or staging GCP resources and to avoid cloud usage costs, the team launches the local emulator within a CI pipeline container using the command `gcloud emulators firestore start --host-port=127.0.0.1:8080`. Which configuration step must be executed in the test execution container to ensure Google Cloud client SDKs automatically route all database requests to the local emulator without modifying application source code or requiring active GCP credentials?
- Export the environment variable FIRESTORE_EMULATOR_HOST=127.0.0.1:8080 in the test execution container shell session before running test scripts.Answer
- BGrant the test runner pipeline service account the primitive Owner role (roles/owner) on the GCP project to enable emulator endpoint redirection permissions.
- CDeploy a dedicated Google Kubernetes Engine (GKE) cluster in a sandbox GCP project to act as a localized protocol translation proxy for database requests.
- DStore and persist emulator database state inside an unversioned local directory instead of relying on environment variable configuration.
Answer
Export the environment variable FIRESTORE_EMULATOR_HOST=127.0.0.1:8080 in the test execution container shell session before running test scripts.
Exporting FIRESTORE_EMULATOR_HOST=127.0.0.1:8080 sets the standardized environment variable that Google Cloud SDK client libraries automatically detect. When populated, client libraries redirect calls to the local emulator address instead of live GCP endpoints and disable production authentication requirement.
Step-by-Step Solution
Key Concept
Cloud Emulators and SDK Environment Variables
Estimated Time:2m 0s