Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
Your team is building an order-processing microservice that depends on a PostgreSQL database, a Redis cache, and a downstream inventory microservice. You want to automate integration tests in Cloud Build (cloudbuild.yaml) whenever code is pushed to the repository.
Your testing pipeline has the following requirements:
Which approach should you implement?
docker-compose.yaml file. Add a step in cloudbuild.yaml using a Docker Compose builder to start the services, run the integration tests with --exit-code-from, and automatically tear down the containers when the ephemeral build VM exits.Docker Compose is a multi-container orchestration tool that defines and runs linked application services using a single declarative docker-compose.yaml file. Inside Cloud Build, each build runs on a dedicated, ephemeral virtual machine equipped with Docker Engine, enabling you to spin up a complete microservice stack—including databases, caches, and dependent APIs—within a single build invocation.
docker compose inside that VM ensures every pipeline execution gets fresh PostgreSQL, Redis, and inventory service containers with zero interference between concurrent builds.postgres:5432 or redis:6379.docker compose up --abort-on-container-exit --exit-code-from test-runner stops all backing containers as soon as the test container finishes and forwards the test suite's non-zero exit code to Cloud Build, failing the build immediately.depends_on with healthchecks), and environment variables locally within the build.docker-compose.yaml locally on their workstations before pushing code.Unlike sequential cloudbuild.yaml steps that exit before subsequent steps start, or shared cloud-hosted staging databases that suffer from cross-build state pollution, Docker Compose keeps all backing services alive concurrently for the exact duration of the test suite while preserving strict per-build isolation.
cloudbuild.yaml to inject those endpoints so all builds run integration tests against the shared environment.Cloud SQL and Memorystore for Redis are persistent, fully managed Google Cloud database and caching services, while Secret Manager securely stores sensitive connection strings, host IPs, and credentials. Combining them with Cloud Build private pools allows builds to reach private VPC endpoints over internal networking.
You were deploying a persistent staging or QA environment (for example, deploying a Cloud Run service via Terraform or Cloud Deploy) or running post-deployment end-to-end tests that specifically require managed Google Cloud services rather than isolated CI integration tests.
In CI pipelines, ephemeral environments are a core best practice because they eliminate cross-build contamination. While Secret Manager is ideal for protecting real credentials during builds and deployments, using local containerized dependencies for integration tests avoids shared-state collisions.
cloudbuild.yaml for the database, cache, dependent microservice, and integration test runner without detached execution, relying on the default cloudbuild Docker network so the test step can connect to the earlier steps by container name.cloudbuild network areCloud Build steps execute as individual docker run invocations defined in cloudbuild.yaml. By default, Cloud Build attaches every step container to a shared local Docker bridge network named cloudbuild and mounts the shared /workspace directory so consecutive steps can exchange build artifacts.
waitFor: ['-'] to launch steps concurrently, Cloud Build waits for every build step container to exit before finishing the build. Long-running daemon processes like PostgreSQL or Redis do not terminate on their own, causing the entire build to hang until it hits the build timeout.condition: service_healthy) or --abort-on-container-exit termination logic.cloudbuild network enables communication between concurrently running containers—such as a detached background container launched explicitly via docker run -d --network=cloudbuild—foreground build steps cannot act as persistent backing services.You explicitly used gcr.io/cloud-builders/docker with docker run -d --network=cloudbuild --name postgres to launch each backing service as a detached background container, rather than running them as standard foreground build steps.
A common misconception is assuming that listing database and application images as separate entries in steps: works like Kubernetes Pod sidecars. In Cloud Build, steps: represents a sequential pipeline of commands unless containers are explicitly daemonized or orchestrated with Docker Compose.
service.yaml manifest defining the test runner as the ingress container and the database, cache, and microservice as sidecar containers communicating over localhost, and pass it directly to gcloud builds submit.service.yaml manifest isA Cloud Run multi-container manifest (apiVersion: serving.knative.dev/v1) defines a deployable Cloud Run service consisting of one ingress container (receiving external HTTPS traffic on a configured containerPort) and up to nine sidecar containers sharing the same network namespace and localhost interface.
gcloud builds submit: The gcloud builds submit command expects a Cloud Build configuration (cloudbuild.yaml or cloudbuild.json) or a Dockerfile—not a Knative/Cloud Run service manifest. Passing a Cloud Run service.yaml directly to Cloud Build will not orchestrate build-time integration tests.gcloud run services replace service.yaml, deploying live Cloud Run revisions for every commit adds deployment latency, IAM configuration overhead, and extra cleanup steps rather than running self-contained tests inside Cloud Build.http://localhost or container name within a deployed Cloud Run instance, not within Cloud Build's Docker step runner.You were deploying the production microservice itself to Cloud Run alongside a runtime helper such as an OpenTelemetry collector or Nginx reverse proxy—not executing automated integration tests inside Cloud Build.
Students often confuse runtime sidecar deployment on Cloud Run or GKE with ephemeral test-dependency orchestration in Cloud Build. Although both use the term "sidecar," Cloud Build relies on Docker networks and tools like Docker Compose rather than Knative Service YAML manifests.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated