Design a Presubmit Test Scheduler for a Monorepo CI System

Last updated: November 29, 2026

Quick Overview

Design a continuous integration system for a monorepo with billions of lines of code that decides which tests to run for each change, schedules millions of test targets per day onto a shared build farm, and reports results quickly.

Google
System Design
Software Engineer
Google
November 29, 2026
Software Engineer
Onsite
System Design
Hard

0

0

0 solved


Design a continuous integration system for a monorepo with billions of lines of code that decides which tests to run for each change, schedules millions of test targets per day onto a shared build farm, and reports results quickly.

Google's single monorepo and its test automation platform make this a distinctively Google question. The interviewer is looking for dependency-graph based test selection, caching of build and test results, and scheduling that keeps presubmit latency low while postsubmit soaks up remaining capacity.

What the Interviewer Expects
  • Use the build dependency graph to select affected tests
  • Cache build actions and test results by content hash
  • Prioritize presubmit over postsubmit and batch postsubmit runs
  • Handle flaky tests without blocking developers
  • Describe culprit finding when batched runs fail
Key Topics to Cover
dependency graph
content-addressed cache
priority scheduling
flaky tests
culprit finding
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How would you handle a change to a core library that affects millions of targets?
  • How do you detect and quarantine flaky tests?
  • How do you find which change in a batch broke a test?
  • How do you share the build farm fairly between teams?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Every code review triggers presubmit tests for affected targets; results in minutes for typical changes.
  • After submission, continuous postsubmit runs ensure head is green.
  • Tens of thousands of c...
High-Level Design
  • Change listener receives a change and its file list.
  • Affected target analyzer queries a precomputed reverse dependency index from the build graph (Bazel-style) to find test targets transit...

Submit Your Answer
Markdown supported