Pinterest
14 min read

Slashing CI Wait Times: How Pinterest Cut Android Testing Build Times by 36%+

Read Full Article

Summary

This article discusses Pinterest's approach to reducing CI wait times for Android end-to-end testing by implementing a runtime-aware sharding mechanism. The previous method of sharding tests by package names led to significant imbalances in execution times, causing delays due to the slowest shard. By leveraging historical test duration data, Pinterest developed a new in-house testing platform that optimally distributes tests across shards to ensure similar runtimes. The implementation resulted in a 36% reduction in build times and improved developer productivity by minimizing the impact of flaky tests and optimizing resource allocation on EC2-hosted emulators.

Key Learnings

  • 1Implementing runtime-aware sharding can significantly reduce CI build times by balancing test execution across shards.
  • 2Historical test duration data is crucial for optimizing test allocation and improving overall CI efficiency.
  • 3Transitioning from third-party testing platforms to an in-house solution can provide better control over testing infrastructure and reduce flakiness.
  • 4Utilizing a greedy algorithm for test assignment can lead to more predictable runtimes and improved resource utilization.
  • 5Continuous monitoring and adjustment of the sharding algorithm based on performance metrics can further enhance developer experience.

Who Should Read This

Senior Software Engineers focusing on CI/CD optimization and test automation strategies

Test Your Knowledge

?

What are the trade-offs between using third-party testing platforms versus building an in-house solution for CI?

?

How does the runtime-aware sharding algorithm ensure balanced execution times across test shards?

?

What challenges did Pinterest face with their previous testing setup using Firebase Test Lab, and how were these addressed?

?

In what ways can historical test data be leveraged to improve CI/CD processes beyond just sharding?

?

What potential failure scenarios could arise from the new sharding mechanism, and how might they be mitigated?

Topics

Read Full Article at Pinterest