21 ms·
Don't know what language or database you use, but check this out: https://github.com/peterldowns/pgtestdb https://github.com/peterldowns/pgtestdb If you happen
by avg_dev 2y ago
Don't know what language or database you use, but check this out: https://github.com/peterldowns/pgtestdb https://github.com/peterldowns/pgtestdb
If you happen to use Postgres, the approach is ultimately portable: it uses Pg database templates (also, regarding perf, the author recommends using a ramdisk and turning off fsync on your test DBs; you'll see this in the project readme). But you’ll have to write the code yourself.
- thom 2y agoThis is what I do, it has an overhead of about 10-20ms per test and I’ve had zero flakiness. Absolute no brainier from my point of view.
- peterldowns 2y agoReally glad to hear it's been working for you with zero flakiness! If you ever do run into any trouble, or have any suggestions for improvements, come on over to the github issues page :)
- peterldowns 2y agoAuthor here, thanks for linking my project — I hope it's been working well for you!
- jph 2y agoThis is so great Peter-- first I've heard of pgtestdb and it's immediately useful for me. How can people donate money to the pgtestdb project? Or hire you for consulting for pgtestdb? I'm joel@joelparkerhenderson.com and would love to help fund your work.
- peterldowns 2y agoI sincerely appreciate the sentiment and the offer — but pgtestdb is MIT license, actual, for real, not kidding, open source. No payment necessary; please enjoy. (I'm always open to discuss potential contracts or consulting opportunities. If you have one that you think might be a good fit, my email is in my profile here and on github and on my homepage.)
- avg_dev 2y agoHow much of a commission do I make? ;)