Bird
0
0

You have this GitLab CI job snippet:

medium📝 Troubleshoot Q14 of 15
Django - Deployment and Production
You have this GitLab CI job snippet:
test:
  script:
    - python manage.py test
  only:
    - main
    - develop

But tests are not running on your feature branch pushes. What is the likely problem?
AThe script command is incorrect
BThe pipeline YAML file is missing
CThe job is limited to run only on main and develop branches
DThe tests are skipped because of syntax error in Python code
Step-by-Step Solution
Solution:
  1. Step 1: Understand the 'only' keyword in GitLab CI

    The 'only' keyword restricts job execution to specified branches, here main and develop only.
  2. Step 2: Analyze why feature branches don't run tests

    Since feature branches are not listed, the job does not run on them.
  3. Final Answer:

    The job is limited to run only on main and develop branches -> Option C
  4. Quick Check:

    'only' limits branches = B [OK]
Quick Trick: 'only' controls branches where job runs [OK]
Common Mistakes:
MISTAKES
  • Thinking script command is wrong without checking
  • Assuming pipeline file is missing
  • Blaming test code syntax without evidence

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes