DOP-C02 SDLC Automation Practice Question
A development team uses AWS CodeCommit for source control and AWS CodePipeline for CI/CD. They have configured a CodeBuild project that triggers on pushes to the 'develop' branch. The build runs unit tests and packages the application. However, developers report that the pipeline fails intermittently with a 'BUILD_FAILED' status due to test failures, but the tests pass locally. What is the MOST likely cause of this discrepancy?
⚠ Common exam trap
The trap here is that candidates may focus on network or timeout issues (options A and B) instead of recognizing that environment inconsistency is the classic cause of 'works on my machine' failures in CI/CD pipelines.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The CodeBuild project has different environment variables or dependency versions compared to the local environment.
The most common cause of tests passing locally but failing in CodeBuild is environment inconsistency. CodeBuild runs in a managed environment with specific runtime versions, environment variables, and dependency caches that may differ from the developer's local machine. This discrepancy can lead to test failures due to different library versions, missing environment variables, or platform-specific behaviors.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The CodeBuild project is configured with a VPC that restricts access to external dependency repositories.
Why it's wrong here
A CodeBuild project with a VPC configured to restrict access to external dependency repositories would typically cause consistent, build-wide failures — every dependency download or package install would hit network errors, not just specific tests. Such a misconfiguration would produce errors like 'unable to resolve dependency' or timeout errors during the install phase, which are deterministic. In contrast, the problem statement describes intermittent test failures while other phases succeed, so a network egress restriction cannot explain tests passing locally but failing in CodeBuild. VPC issues affect all builds equally, not a subset of test cases.
- ✗
The CodePipeline has a timeout setting that causes the build to be terminated before tests complete.
Why it's wrong here
A CodePipeline timeout (or CodeBuild build timeout) terminates the entire build process after a fixed duration, regardless of whether tests are passing or failing. Timeout misconfigurations cause consistent 'TIMED OUT' errors across every run, not occasional test assertion failures. Moreover, the default build timeout in CodeBuild is 60 minutes, which is generally sufficient for a standard test suite; if a timeout were the issue, you would not see flaky, intermittent test results that differ between runs. Therefore, a timeout setting is not a plausible cause for tests that fail non-deterministically in CodeBuild.
- ✗
The CodePipeline is configured with a branch filter that only triggers on the 'main' branch.
Why it's wrong here
A branch filter in the CodePipeline source action would prevent the pipeline from executing at all for 'develop' branch commits, leaving developers with no build or test results. The symptom of intermittent test failures implies builds are being triggered and running to completion — meaning the pipeline is actively executing. A branch filter is a binary gate: either the pipeline triggers or it doesn't — it cannot selectively cause individual tests to fail. Thus, this option explains a lack of pipeline runs, not flaky test outcomes.
- ✓
The CodeBuild project has different environment variables or dependency versions compared to the local environment.
Why this is correct
CodeBuild executes in a managed build environment that uses a specified image (e.g., Amazon Linux with a particular JDK, Node.js, or Python version) and its own set of environment variables and pre-installed tool versions, which may differ from the developer's local machine. Dependency resolution without strict lockfiles can pull different minor or patch versions of libraries in CodeBuild than those present locally, leading to behavioral changes that break tests intermittently. Similarly, environment variables such as API endpoints, feature flags, or locale settings can alter application logic at runtime. This environmental divergence is the classic 'works on my machine' problem and directly explains why tests pass locally but intermittently fail in CodeBuild.
Go deeper
Related to this question
About these practice questions
One of 1,298 original DOP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.