Open mkosta opened 7 months ago
Hi @mkosta ππ»
Thanks for pointing that out. Indeed ππ» As you've found out, the issue you're experiencing is likely because you're passing the arguments as a string, whereas we expect an array/sequence of strings in that case. That's essentially how the Redis protocol serializes it under the hood, it expects to receive a list of arguments that will be \r\n
separated, and both our API and the underlying library we use reflect that implementation detail.
I also noticed that we haven't provided type definitions for that specific command in DefinitelyTyped, which probably didn't help either.
We should indeed, document that kind of case more explicitly indeed ππ»
I believe this is a valid issue, but we should rather move it to the k6 documentation repository's issue, what do you think @codebien ? ππ»
@oleiade I agree, we can transfer it. What is your expectation to fix it? Can we directly link the go-redis library? Otherwise, if we need to write all the details in the doc, we will end in rewriting the same doc as they have. Opinions?
I would expect the actionable to make a pass on Redis examples in the documentation make sure sendCommand
is shown, and ensure that we provide a real-world example as presented here. We would also explicitly document that it does not send the command arguments as a single string but expects each argument to independently as described here ππ»
thank you, guys! while we are on the subject. do you know why INFO command would return empty result? is it go library not able to capture output or is it lost somewhere between go and k6?
const result3 = await redisClient.sendCommand('INFO');
this logs a lot of empty space, kinda the size of INFO output from cli, except no text is present) this command with grep args would be quite helpful to get keys count, connected clients and what not
smth like this
let args = ['|','grep','clients'];
const result3 = await redisClient.sendCommand('INFO',...args);
console.log(typeof result3);
console.log(result3);
outputs this empty string
INFO[0004] string source=console
source=console
INFO[0004] Preparing the end-of-test summary... source=console
if i pass command like this, i get error ERR invalid cursor
if i send only cursor
returns keys.
It seems there is some issue with passing parameter here. Pattern with keys command works. probably because it is a single parameter
Would be useful to have not just example with "Echo, Hello World", but more complicated case with arguments.
When trying to pass arrays in sendCommand arguments i get
So i am confused how to pass second argument. Thanks for advice or fix
for example this one works
this one returns error Uncaught (in promise) ERR syntax error
PS we figured second paramets had to be split in two as well
should have example like this for dumb people like me)))