A backend engineering team is configuring an automated integration testing pipeline inside a CI/CD container for a microservice that interacts with Cloud Pub/Sub and Cloud Firestore. They want to execute tests locally against Google Cloud emulators without making live GCP API calls or supplying actual cloud credentials. Which TWO configuration actions must the team take to ensure the client libraries automatically route traffic to the emulators? (Select TWO)
- Export the PUBSUB_EMULATOR_HOST environment variable set to the host and port where the Pub/Sub emulator is listening.Cevap
- Export the FIRESTORE_EMULATOR_HOST environment variable set to the host and port where the Firestore emulator is listening.Cevap
- CMount a JSON service account key file assigned the primitive roles/owner role into the test container environment.
- DProvision a dedicated Google Kubernetes Engine (GKE) cluster in GCP to execute the emulator process and proxy API calls.
Cevap
To configure Google Cloud client libraries to communicate with local emulators, the team must set the specific host environment variables `PUBSUB_EMULATOR_HOST` and `FIRESTORE_EMULATOR_HOST`. When these environment variables are detected in the execution environment, GCP client libraries automatically disable standard IAM authentication checks and route all network traffic to the designated local host and port endpoints.
Google Cloud client libraries automatically check for specific environment variables upon initialization. When `PUBSUB_EMULATOR_HOST` and `FIRESTORE_EMULATOR_HOST` are present in the runtime environment, the SDKs route all request payloads to the specified local endpoints and bypass authentication requirements. This allows fast, cost-free, isolated integration testing within CI/CD pipelines.
Adım Adım Çözüm
Anahtar Kavram
Configuring service-specific environment variables for local GCP emulators in automated test pipelines