A DevOps engineering team is configuring an isolated CI/CD build container to run automated integration tests against a local Cloud Pub/Sub service instance. Which TWO configuration actions are required to ensure application client libraries interact exclusively with the local emulator without attempting to connect to live Google Cloud services? (Select TWO)
- Start the Pub/Sub emulator process inside the test container using the command `gcloud beta emulators pubsub start --host-port=0.0.0.0:8085`.Answer
- BMount a valid service account JSON key file into the container and set `GOOGLE_APPLICATION_CREDENTIALS` to authorize emulator requests.
- Export the `PUBSUB_EMULATOR_HOST` environment variable set to the emulator endpoint (e.g., `localhost:8085`).Answer
- DGrant the primitive `roles/owner` IAM role to the service account executing the CI/CD pipeline runner.
Answer
The correct actions are starting the Pub/Sub emulator process with `gcloud beta emulators pubsub start --host-port=0.0.0.0:8085` and setting the `PUBSUB_EMULATOR_HOST` environment variable to route client library traffic to the local emulator endpoint.
Executing the command `gcloud beta emulators pubsub start` starts the local server process, while exporting `PUBSUB_EMULATOR_HOST` directs GCP client libraries to communicate with the local host instead of production Google endpoints, completely removing the need for cloud authentication.
Step-by-Step Solution
Key Concept
Cloud Pub/Sub Local Emulator Setup and Client Routing