Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
22.79k stars 1.58k forks source link

Split server tests out by database #14992

Closed samwho closed 1 week ago

samwho commented 2 weeks ago

Description

Prior to this PR, our test-server part of the CI process ran the full test suite for packages/server in a single runner, with all of the databases we test against running at the same time. This necessitated us running on larger runners than the default due to the memory usage, and over time has grown to take over 15 minutes.

This PR splits test-server out into per-database shards. Each shard runs the specific database being tested against, and only runs tests that depend on that database. There's an extra shard for tests that do not require a database to be running.

This is all achieved through a new test function called datasourceDescribe. This is designed to act like a normal Jest describe, except you pass in the datasource types you want to test against and it manages the setup of the datasources for you. It also takes into account a DATASOURCE environment variable, which you can specify to limit the tests to just that datasource. This is how we limit CI to specific datasources.

I'm also making use of Jest filters to be able to split tests into ones that need a datasource (by looking for the string datasourceDescribe in each test file), and ones that don't.

qa-wolf[bot] commented 2 weeks ago

QA Wolf here! As you write new code it's important that your test coverage is keeping up. Click here to request test coverage for this PR!