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

How to test client-unsupported commands via client.Do() #25

Open
ideasculptor opened this issue Jan 27, 2022 · 1 comment
Open

How to test client-unsupported commands via client.Do() #25

ideasculptor opened this issue Jan 27, 2022 · 1 comment

Comments

@ideasculptor
Copy link

ideasculptor commented Jan 27, 2022

It seems as though there is no way to test code which uses client-unsupported commands via:
client.Do(ctx, "cmd", ...args)

There definitely seems to be no example and I see no Issues filed which mention it, and there is no immediately obvious way to set an expectation for an arbitrary Cmd when looking at the source code. This prevents testing of any code which uses a custom redis module to provide commands not natively supported by the redis client, which seems like a relatively common use case, so I'm wondering if this is an oversight in the documentation and example code?

@ideasculptor
Copy link
Author

I should elaborate - my code actually uses a pipeline to execute multiple custom commands.

	cmd := pipe.Do(ctx, "CL.THROTTLE", req.key, req.maxBurst, req.limit, req.period*time.Second, 1)

which is eventually executed via:

	cmders, err := pipe.Exec(ctx)

Given the example code for testing pipeline, I would imagine that if Do() were supported, pipelining Do() would also be supported by setting an expectation for each pipelined command.

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