Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project is dead and you should not use it anyway #113

Open
fredericgboutin-yapla opened this issue Nov 7, 2023 · 0 comments
Open

Project is dead and you should not use it anyway #113

fredericgboutin-yapla opened this issue Nov 7, 2023 · 0 comments

Comments

@fredericgboutin-yapla
Copy link

fredericgboutin-yapla commented Nov 7, 2023

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,

  1. people simply mock the Redis client straight up, mocking the ->set() function, etc.
  2. 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,

  redis:
    container_name: redis
    restart: unless-stopped
    image: redis:latest
    command: redis-server --loglevel notice

And then with Gitlab CI/CD it is even more easier, https://docs.gitlab.com/ee/ci/services/redis.html

services:
  - redis:latest

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant