You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sure at the time of writing there was an update back in May 2023 but here is the thing, this project is trying to mimic a Redis server in PHP. No small feat.
We just came out of 2 days of searching why our unit tests would randomly fail. We noticed that "waiting enough" was a "solution" only to realize that the SET method doesn't properly support the EX argument - more specifically Predis allows for $predis->set('my key', 'my value', 'EX', 1000); when this lib would only support $predisMock->set('my key', 'my value', ['EX' => 1000]); - effectively applying a none-determined TTL thus explaining the side-effect.
We then began to fork the project in order to contribute with a fix. We tried to follow the README saying we should use vagrant for running the unit tests - aka https://github.com/BedrockStreaming/RedisMock#tests - so we could TDD ourselves here, only to realize that the referenced image doesn't exist anymore and obviously vagrant is a dead technology now, so...
And it is at that moment we asked ourselves, why? Why would we try to fix this specific behavior when there are probably plenty of others waiting for us to uncover. And most importantly, what do people do in our situation, when they need to "mock Redis"?
Well,
people simply mock the Redis client straight up, mocking the ->set() function, etc.
when you cannot "simply mock Redis" because your unit test is more "functional" than "unit", then you should use... Redis itself 🤷
It's easy and fast to bootstrap a clean Redis instance, especially with docker,
Anyway, the point of this is issue is to warn people looking to use redis-mock. That would be nice to have a disclaimer in the README file as well.
I would like to take a moment of gratitude to the dev(s) and maintainer of the project 🙏 even though I think it's a bad idea to go down that route I respect the effort and dedication.
The text was updated successfully, but these errors were encountered:
Sure at the time of writing there was an update back in May 2023 but here is the thing, this project is trying to mimic a Redis server in PHP. No small feat.
We just came out of 2 days of searching why our unit tests would randomly fail. We noticed that "waiting enough" was a "solution" only to realize that the
SET
method doesn't properly support theEX
argument - more specifically Predis allows for$predis->set('my key', 'my value', 'EX', 1000);
when this lib would only support$predisMock->set('my key', 'my value', ['EX' => 1000]);
- effectively applying a none-determined TTL thus explaining the side-effect.We then began to fork the project in order to contribute with a fix. We tried to follow the README saying we should use
vagrant
for running the unit tests - aka https://github.com/BedrockStreaming/RedisMock#tests - so we could TDD ourselves here, only to realize that the referenced image doesn't exist anymore and obviously vagrant is a dead technology now, so...And it is at that moment we asked ourselves, why? Why would we try to fix this specific behavior when there are probably plenty of others waiting for us to uncover. And most importantly, what do people do in our situation, when they need to "mock Redis"?
Well,
->set()
function, etc.It's easy and fast to bootstrap a clean Redis instance, especially with docker,
And then with Gitlab CI/CD it is even more easier, https://docs.gitlab.com/ee/ci/services/redis.html
I suppose it is also something easy to achieve on Github - https://docs.github.com/en/actions/using-containerized-services/creating-redis-service-containers
Anyway, the point of this is issue is to warn people looking to use
redis-mock
. That would be nice to have a disclaimer in the README file as well.I would like to take a moment of gratitude to the dev(s) and maintainer of the project 🙏 even though I think it's a bad idea to go down that route I respect the effort and dedication.
The text was updated successfully, but these errors were encountered: