Over the last three quarters, the team at PlanetScale has focused on the dual goals of making open source Vitess easy to use and easy to contribute to. A part of this effort was a migration of all the integration tests written in Python to Go.
There were several reasons for this project:
This was a fairly massive project that required several people working on it for almost four months. The project was started around November 1, 2019 and completed on February 25, 2020. There were 197 separate integration tests in 39 files that had to be migrated. In terms of LOC, it was over 24,000 lines of Python code.
In order to accomplish the migration, we first built a test framework in Go (using the command and testing packages) that allowed us to start a Vitess cluster and interact with it programmatically. The framework had to support running multiple tests in parallel without port conflicts; create non-conflicting working directories for all the relevant processes; log sufficient information to enable failure diagnosis, etc. Once that was done, it was a matter of translating Python tests into the equivalent Go code.
Along the way, we were also able to improve the CI pipeline for Vitess. While Travis CI has served us well over the years, we saw an opportunity to switch to GitHub actions. The advantages?
The end result of the project is that it is now much easier and faster to develop new integration tests. It is also easier for someone new to the project to get started. The CI changes give us quicker feedback on pull requests and increase throughput on pull requests.
To learn more, join the Vitess Slack channel and attend the next monthly open meeting on Thursday, March 19 to hear Arindam Nayak talk about this project in detail. The meeting details can be found in the Vitess Slack channel.