test: add toxiproxy in front of postgresql in withTmpDb#4674
test: add toxiproxy in front of postgresql in withTmpDb#4674mkleczek wants to merge 1 commit intoPostgREST:mainfrom
Conversation
6736e0c to
e5d1bd6
Compare
|
Great initiative 👍
Not against using toxyproxy, but just thought I'd mention we do have a custom tool to simulate delays: https://github.com/robx/slocat. It's already used in some places: postgrest/nix/tools/withTools.nix Line 250 in 2edc44c postgrest/nix/tools/withTools.nix Line 250 in 2edc44c If not too complicated, an alternative would be to develop a similar tool (in Go or maybe C). |
Yeah, I'm aware of |
11aa9ce to
dd59a08
Compare
Can toxiproxy do the same thing and more as slocat? Can we replace slocat? |
Yeah, I think so: https://github.com/Shopify/toxiproxy?tab=readme-ov-file#toxics Wanted to leave removal of |
Personally, I think it'd be easier to track by first doing a straight replacement of slocat with toxiproxy, allowing us to do the same things with it - and then extending the use of toxiproxy to other usecases. That will prevent us from having a state with both tools in there, which might become messy (I have not looked at the code at all, yet). |
2f08484 to
6c90615
Compare
I agree, that would also make the PR easier to review + allow us to get familiar with toxyproxy for an existing use case. |
I am splitting this PR into multiple commits. The first one is 6c90615 Not sure if you prefer them to be separate PRs or splitting them into multiple commits in a single PR is enough. |
It's easier to review on different PRs 🙏 |
DISCLAIMER: This commit was authored entirely by a human without the assistance of LLMs.
DISCLAIMER:
This commit was authored entirely by a human without the assistance of LLMs.Having toxiproxy between PostgREST and PostgreSQL in tests opens possibilities of validating behavior of PostgREST under various network conditions: temporary network partitioning, delays etc.
This change adds toxiproxy startup and configuration to withTmpDb function in withTools.nix, so that all communication goes through it in tests.
There is a Haskell and Python client available so that it is possible to easily control network conditions from both
HSpecandiotests.It would be very useful (if not necessary) to properly test #4673