HeyPuter / puter

🌐 The Internet OS! Free, Open-Source, and Self-Hostable.
https://puter.com
GNU Affero General Public License v3.0
24.58k stars 1.58k forks source link

Test pipeline for database migrations. #641

Open KernelDeimos opened 1 month ago

KernelDeimos commented 1 month ago

We need a way to test database migrations for all possible initial states. This can be accomplished with a test that iterates over the migrations and runs a Puter clone starting at that version, and upgrades it. Version -1 (i.e. new database) should also be included so issues like #639 never happen again. It should also be possible to add additional changes to test at each version, such as having a user named system before the migration script which adds the new system user.

KernelDeimos commented 1 month ago

First bit of work on this: 02504690cfb1a790b44b6447f918680047af0148

We can now run an instance of Puter that will immediately shutdown upon successful boot or any alarm with a corresponding (0 or 1) exit code. This makes an easy test case for migrations that fail with an exception.