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

Feature request: Return errors for commands after call to client.disconnect() #1198

Open
TysonAndre opened this issue Oct 3, 2022 · 0 comments

Comments

@TysonAndre
Copy link
Contributor

Observed: After an explicit call to disconnect, commands succeed with RedisMock = require('ioredis-mock')
Expected: Commands should fail, like they do for ioredis

> RedisMock = require('.'); null
null
> r = new RedisMock(); r.disconnect(); console.log({result: await r.set('foo', 'bar')});
{ result: 'OK' }
> Redis = require('ioredis'); c = new Redis(); c.disconnect(); await c.set('foo', 'bar');
Uncaught Error: Connection is closed.

In addition to this, it'd be useful to mock other failure modes, e.g. a read-only redis replica failing for write operations but not read operations

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

No branches or pull requests

2 participants