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

Atomically decrease all TTLs #5972

Open
rightaway opened this issue Mar 28, 2019 · 4 comments
Open

Atomically decrease all TTLs #5972

rightaway opened this issue Mar 28, 2019 · 4 comments

Comments

@rightaway
Copy link

I'd like to do integration (or even end to end) testing in an application that uses redis. But to do that I need to test certain keys before and after their TTL goes to 0, but of course I can't have a test wait an hour for a particular key with a one hour TTL to expire.

It would help to have a command in redis to simulate skipping the time ahead, something like TIME -3600 to atomically decrease all TTLs by an hour. I'm currently using unit testing but this feature would allow me to do integration testing to really ensure application robustness.

@RajatPawar
Copy link
Contributor

Could we introduce a client flag (for TTL_SIMULATE) & a field (how much to scale down the TTL) which we could then check in SetGenericCommand?

(Apologies in advance for mistakes, I am very newly joining the contribution community)

@jaamison
Copy link
Contributor

This seems kind of bloat/creep-ish to add to redis core. I realize this may not be a feasible option for you, but just a random thought: Maybe you can parameterize your TTL values in your application so you can specify arbitrary lower values for your unit tests?

@itamarhaber
Copy link
Member

It would help to have a command in redis to simulate skipping the time ahead

Or, you could set the server's clock via the OS to a time in the future instead.

@rightaway
Copy link
Author

@itamarhaber That would break a lot of other expected and unexpected things. It's not a good idea to just change a server's time.

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

4 participants