MySQL in memory for faster testing
During a fit of ‘dammit, why is this test suite taking so long to run?’, I decided to try and squeeze a bit of extra speed out of my development setup.
I’m not going to delve into test suite optimisations, that is for another post. The tests in question were running faster on other peoples machines and that made me sad!
Script
What we have below isn’t new. I’ve taken what I found in this blog post and created a bash script which I can run after each reboot (there is also a teardown script).
These are macOS scripts at the moment but can be very easily updated to work with Linux. I’ll do this in due course.
This started as a gist but is much better at home in a repo. Behold!
Setup
Copy the mysql-ramdisk-config.sh.example file to mysql-ramdisk-config.sh and make any updates as required.
Usage
Run the script from your project (this is required to run the commands in ENVIRONMENT_SETUP_COMMANDS).
neil | ~/src/myrailsproject (master) $ ls -1 ../mysql-ramdisk-helper
LICENSE
README.md
mysql-ramdisk-config.sh
mysql-ramdisk-config.sh.example
mysql-ramdisk-setup.sh
mysql-ramdisk-teardown.shneil | ~/src/myrailsproject (master) $ ../mysql-ramdisk-helper/mysql-ramdisk-setup.sh