3 ms·
Most of our projects are mysql, and in those we don't use any db-specific features. Those all use in-memory sqlite for tests. Only in one of our projects do w
by Izkata 3y ago
Most of our projects are mysql, and in those we don't use any db-specific features. Those all use in-memory sqlite for tests. Only in one of our projects do we use jsonb with postgres, that one does use postgres for the tests as well. Though, that project probably didn't need it - we're just sort of stuffing semi-regular data from another system into it. It would have worked just as well as a text field that was parsed as-needed, since as far as I remember we don't query it directly, only query based on other columns in that table.
- anticodon 3y agoYou can run tests in MySQL in memory almost as easily. database-autotests: volumes: - mysql-autotests-volume:/var/lib/mysql volumes: mysql-autotests-volume: driver_opts: type: tmpfs o: "size=2G,mode=777" device: tmpfs It's also very fast and allows to test the code on the same database, especially if you have something MySQL-specific.
- deleted 3y ago[deleted]
- Izkata 3y agoNot sure what that is, docker? None of the several dozen projects I'm referring to use it.
- ragnese 3y agoYes, that looks like a docker-compose config. But, it doesn't really matter. The point is that you could run MySQL in a way such that its storage (the actual data files) are on a virtual filesystem running in RAM. It's a nice way to do it, IMO, because I prefer testing against a real DB instance in my projects anyway (rather than pretending that a unit test against a fake 'FooRepository' interface proves anything at all).