GCP Professional Cloud Architect Practice Question

Your team maintains a Java microservice that publishes to and consumes from Cloud Pub/Sub using the official Java client libraries. You need to introduce unit tests that will run inside your Cloud Build CI pipeline and must meet these constraints:

  • Execute quickly with no outbound network connectivity
  • Avoid all Google Cloud charges
  • Require no changes to the production code path that constructs the Pub/Sub client

Which approach best satisfies these requirements?

  • Replace the Pub/Sub client with Mockito stubs that instantly acknowledge publish and pull operations.

  • Start the Cloud Pub/Sub emulator in the CI job and, in test setup code, build Pub/Sub clients whose endpoint is set to the emulator's localhost address.

  • Create a single-node GKE cluster during the build and access managed Cloud Pub/Sub through Private Google Access.

  • Run the tests against a dedicated Cloud Pub/Sub instance in a separate project and delete topics and subscriptions after each build.

GCP Professional Cloud Architect
Managing implementation
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot