Soru

Zorluk: OrtaCloud Emulators and Development Testing Frameworks

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)

  1. 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`.Cevap
  2. B
    Mount a valid service account JSON key file into the container and set `GOOGLE_APPLICATION_CREDENTIALS` to authorize emulator requests.
  3. Export the `PUBSUB_EMULATOR_HOST` environment variable set to the emulator endpoint (e.g., `localhost:8085`).Cevap
  4. D
    Grant the primitive `roles/owner` IAM role to the service account executing the CI/CD pipeline runner.

Cevap

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.

Adım Adım Çözüm

1
Initialize the emulator service
The local Pub/Sub emulator starts and listens for incoming connections on the specified port.
The gcloud CLI emulator component provides a local mock server implementation of the Cloud Pub/Sub service.
2
Configure environment variables for client libraries
The application SDKs automatically bypass authentication and send requests to the local host.
Google Cloud client libraries inspect specific environment variables (such as `PUBSUB_EMULATOR_HOST`) to override default endpoint routing and credentials requirements.

Anahtar Kavram

Cloud Pub/Sub Local Emulator Setup and Client Routing
Bu soruyu puanla