Skip to content

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

@fredericgboutin-yapla

Description

@fredericgboutin-yapla

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions