Re:Database mocks are just not worth it
by nerdponx on Monday December 30, 2024 @04:11PM
(#42553580)
[delayed]
[ Parent
| on HN ]
Re:Database mocks are just not worth it
by pdimitar on Monday December 30, 2024 @04:25PM
(#42553726)
Exactly what I do. Having a local `docker-compose.yml` that helps bring up a dev and test environments is one of my first action items when hired. Paid huge dividends, many times.
Re:Database mocks are just not worth it
by sickblastoise on Monday December 30, 2024 @09:39PM
(#42555856)
My current setup on a personal project is docker compose with Postgres and pgadmin container.
I would never think of mocking a database in 2024/2025, just spin one up.
Also keep your lynch pin invariants in the database and not in your code.
Re:Database mocks are just not worth it
by bdangubic on Monday December 30, 2024 @09:56PM
(#42555963)
in 2024/2025 you just might be working with 985 petabyte database which just might have a few issues being “spun up” :)
Re:Database mocks are just not worth it
by sickblastoise on Monday December 30, 2024 @10:32PM
(#42556190)
Are you developing directly against your production database?
Re:Database mocks are just not worth it
by bdangubic on Monday December 30, 2024 @10:35PM
(#42556209)
replica in the staging environment
Re:Database mocks are just not worth it
by nerdponx on Tuesday December 31, 2024 @12:48PM
(#42560368)
I am definitely not talking about a full copy of the data here. I more head in mind a small but representative sample, enough to run and exercise units of code with confidence.
Re:Database mocks are just not worth it
by pdimitar on Wednesday January 01, 2025 @07:28AM
(#42565637)
> Also keep your lynch pin invariants in the database and not in your code.
I do both. That is how you protect against stressed devs at 2:00 AM trying to insert crap in the production database and how you also make good apps that don't blow up with database exceptions and give you neat validation errors in forms and/or JSON `errors` keys (when it's an API).