A platform engineering team is setting up an automated integration testing pipeline for a multi-tenant application that executes complex transactions across Cloud Spanner and publishes event notifications to Cloud Pub/Sub. To minimize cost and avoid provisioning real cloud resources during pull request validations, the pipeline runs local emulator instances for both services inside ephemeral Docker containers. During test suite execution, developers report that tests requiring schema DDL modifications fail inside read-write transaction blocks, and event publishing calls attempt to authenticate against production endpoints using Google Application Default Credentials (ADC). Which combination of architectural and operational adjustments will resolve these integration testing failures while adhering to GCP best practices?
- Export the SPANNER_EMULATOR_HOST and PUBSUB_EMULATOR_HOST environment variables in the test runner environment, and separate database schema DDL execution from transaction runtime logic since the Cloud Spanner emulator processes DDL statements synchronously outside active read-write transactions.Answer
- BGrant the primitive Owner role to a service account key embedded in the container image, and store the state of the emulators in unversioned local storage within the runner container.
- CProvision a dedicated Google Kubernetes Engine (GKE) cluster for each integration build to run the microservices alongside full Cloud Spanner and Pub/Sub instances in Google Cloud.
- DGrant the Service Account Admin role to the test runner container so that it can dynamically mint short-lived service account keys to bypass emulator authentication checks.