GCP Professional Cloud Architect Practice Question
Your continuous integration pipeline in Cloud Build needs to run hundreds of tests for a microservice that publishes to Pub/Sub and stores data in Firestore. The current strategy uses a shared non-production Google Cloud project, but engineers report slow feedback, unpredictable costs, and occasional IAM quota errors. You must redesign the pipeline so tests run quickly, avoid generating Google Cloud charges, and still exercise real Pub/Sub topic publishing and Firestore query logic end-to-end. What should you do?
Replace the integration tests with unit tests that use in-memory mocks for Pub/Sub and Firestore, eliminating the need for any emulators or Google Cloud services during CI.
Have the pipeline create a brand-new Google Cloud project for every build, provision Pub/Sub topics and Firestore collections with deployment scripts, run the tests, then delete the project.
Spin up a dedicated GKE Autopilot cluster per commit, deploy the microservice and managed Pub/Sub and Firestore resources to it, and destroy the cluster after tests complete.
Launch the Pub/Sub and Firestore emulators inside each Cloud Build step, export the corresponding *EMULATOR_HOST environment variables, and execute the test suite against the localhost endpoints.
Running the Pub/Sub and Firestore emulators inside the Cloud Build job satisfies all requirements. The emulators start in seconds, expose local host ports that client libraries can target through environment variables such as PUBSUB_EMULATOR_HOST and FIRESTORE_EMULATOR_HOST, and work with the same APIs used against managed services. Because the traffic never leaves the build worker, no Google Cloud resources are consumed, so there are no charges or IAM quota impacts. Creating or tearing down whole projects or clusters would still incur resource charges and API quota usage, while relying only on in-memory mocks would skip the integration layer that the team needs to validate.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What are Pub/Sub and Firestore emulators?
Open an interactive chat with Bash
What is the purpose of the *EMULATOR_HOST environment variables in testing?
Open an interactive chat with Bash
Why are emulators better for CI pipelines than mocks or creating real cloud resources?
Open an interactive chat with Bash
What are Pub/Sub and Firestore emulators used for in testing?
Open an interactive chat with Bash
How do environment variables like PUBSUB_EMULATOR_HOST and FIRESTORE_EMULATOR_HOST work?
Open an interactive chat with Bash
Why are emulators preferable to creating new projects or using mocks in CI pipelines?
Open an interactive chat with Bash
GCP Professional Cloud Architect
Managing implementation
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99 $11.99
$11.99/mo
Billed monthly, Cancel any time.
$19.99 after promotion ends
3 Month Pass
$44.99 $26.99
$8.99/mo
One time purchase of $26.99, Does not auto-renew.
$44.99 after promotion ends
Save $18!
MOST POPULAR
Annual Pass
$119.99 $71.99
$5.99/mo
One time purchase of $71.99, Does not auto-renew.
$119.99 after promotion ends
Save $48!
BEST DEAL
Lifetime Pass
$189.99 $113.99
One time purchase, Good for life.
Save $76!
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .