I have a master/worker setup that uses Redis+RSMQ for task queue. Now I'm writing tests for master and stumbled upon a issue.
One would think that testing RSMQ headlessly one would just need to mock Redis (fe. fakeredis) and be good to go but alas, no such luck.
When initializing RSMQ with fakeredis an error appears:
Error: fakeredis: SCRIPT is not implemented in fakeredis. Let me know if you need it.
Turns out, since RSMQ (& other Redis queue systems) use Lua scripts for various purposes, they aren't really mockable in current state of things.
Is there any way to circumvent this? I would prefer not to build scaffolding around the master & worker code just for testing, plus that would only test that the queue calls are there, not whether they actually are correct (fe. correct queue data, correct Redis namespaces etc.). Also, since I also need Redis pub/sub (for worker status updates) I would prefer to have both functionalities ran on same server (ie. Redis).
Aucun commentaire:
Enregistrer un commentaire