Automating Integration Tests with Cloud Build and GitHub
Short answer
D Use Cloud Build to run tests in a specific folder and trigger Cloud Build for every GitHub pull request.
Question
Key Takeaways
The exam tests your understanding of CI/CD workflow timing, specifically the trap of triggering tests after a merge (which defeats the purpose of gating) versus triggering them before acceptance.
This question examines the correct configuration for integrating Google Cloud Build with GitHub to automate testing on feature branches. It establishes that triggering builds on pull request creation is essential for pre-merge validation.
Common mistake: Many candidates choose option C because it uses Cloud Build, but they overlook the critical timing detail: triggering 'after a pull request is merged' allows untested code to enter the main branch.
Expert Analysis
Why the Answer Is Correct
Option D is the correct answer because it leverages Cloud Build triggers configured for GitHub pull requests. This setup automatically executes integration tests as soon as a PR is created or updated, ensuring that all code changes are validated before they are accepted into the main branch. This aligns with the requirement to ensure all code is tested before changes are accepted.Why the Other Options Are Wrong
Option A suggests using Jenkins, which adds unnecessary complexity when native GCP tools like Cloud Build are available and integrate directly with GitHub. Option B relies on manual human intervention, which contradicts the goal of automation. Option C is incorrect because triggering tests 'after a pull request is merged' means the code enters production/main without prior automated validation, violating the safety gate principle.Community Comment Notes
The community consensus strongly favors D. As user Jay09812 noted, "Wouldnt it be D considering you would want to run the tests when the PR is created and not after the code is already merged." Another commenter highlighted that C is too late: "C is incorrect: Triggering tests after a pull request is merged is too late." This reinforces the importance of pre-merge checks in CI/CD pipelines.Exam Strategy
Always look for keywords like 'automate', 'before changes are accepted', and 'continuous test'. These imply a pre-merge gate. Choose the option that triggers the pipeline on the event that happens before the final state change (e.g., Pull Request created/updated), not after (e.g., Merge completed).
Frequently Asked Questions
Why is option C wrong if it uses Cloud Build?
Do I need a specific folder path in Cloud Build?
Discussion 11 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 11
-
Jay09812 👍 3Wouldnt it be D considering you would want to run the tests when the PR is created and not after the code is already merged
-
xhilmi 👍 2 Answered DChoose option D Use Cloud Build to run tests in a specific folder and trigger Cloud Build for every GitHub pull request. By configuring Cloud Build to run tests in a specific folder, you can focus on the relevant tests for the modified code in the feature branch. Triggering Cloud Build for every GitHub pull request ensures that tests are automatically executed whenever changes are proposed, providing continuous integration. This approach allows for automated testing of each pull request, providing early feedback to developers and ensuring that changes are thoroughly tested before being merged, contributing to a more reliable and efficient development process.
-
mshafa 👍 2 Answered DThis approach automates the testing process, integrates well with your existing tools (GitHub and GCP), and ensures that code is tested in the most relevant part of the development lifecycle - before merging into the main branch.
-
activist 👍 2Answer C is correct. https://cloud.google.com/build/docs/automating-builds/create-manage-triggers
-
pharao89 👍 2 Answered DD is what I do at work for this scenario and it works well.
Show 6 more comments
-
koo_kai 👍 2 Answered Dall code is tested before changes are accepted
-
Jason_Cloud_at 👍 2 Answered CI would go with C
-
BlackCoffee 👍 1 Answered DC is incorrect: Triggering tests after a pull request is merged is too late. The goal of integration testing in a feature branch workflow is to catch issues and gate the code before it is accepted into the main branch.
-
lelele2023 👍 1 Answered Dshouldn't be C since it makes the test to happen after merge. Answer is D - as soon as a PR gets created then it runs tests.
-
6a8c7ad 👍 1 Answered CD mentions folder. Huh? I’ll take C
-
Jason_Cloud_at 👍 1Agreed
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All PCDOE Questions
Access 75 questions with complete answers and detailed explanations.
View Full PCDOE Practice Test →