4 ms·
I would almost agree, but what do you do about external systems? Take postgres for example - yes, you can easily set one up. But how do you test concurrency iss
by valenterry 3y ago
I would almost agree, but what do you do about external systems? Take postgres for example - yes, you can easily set one up. But how do you test concurrency issues due to timing?
This can be necessary but very tricky to achieve without mocks/fakes or whatever it's called.
- mrkeen 3y ago> But how do you test concurrency issues due to timing? You don't. 1) The outcome of the tests will be: 0.1% There is an issue. 99.9% Maybe there's an issue. 2) Finding concurrency issues needs fine-grained targeting. You can't just write a "does anything race?" test. Testing won't reveal the location of the races. You already need to know about the race condition to be able to write a test for it. And once you know it's there, what are you testing? Are you making sure that the system does the wrong thing?
- valenterry 3y agoI meant more concrete cases. Say there is some weird behaviour and you suspect that it's due to a race condition. Maybe someone forgot to do "select for update" and you want to write a test to confirm. How to do that? Even if you know 100% that it's a race condition, you still might want to add a test to prevent it from happening again no?
- IanCal 3y ago> And once you know it's there, what are you testing? That you've fixed it.
- RamblingCTO 3y agoI've had great success with using testcontainers and a self-contained module interfacing with that. As we use hexagonal architecture, these are adapters.