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

Client: IsOptsWithPrefix returns false even if WithPrefix() is included #14056

Closed
mdelissen opened this issue May 20, 2022 · 1 comment · Fixed by #14182
Closed

Client: IsOptsWithPrefix returns false even if WithPrefix() is included #14056

mdelissen opened this issue May 20, 2022 · 1 comment · Fixed by #14182
Assignees
Labels

Comments

@mdelissen
Copy link

mdelissen commented May 20, 2022

What happened?

If you use the function IsOptsWithPrefix with opts containing WithPrefix() it always returns false instead of true.

What did you expect to happen?

IsOptsWithPrefix should return true if opts contains WithPrefix()

How can we reproduce it (as minimally and precisely as possible)?

package main

import (
  "log"
  etcd "go.etcd.io/etcd/client/v3"
)

func main() {
  log.Printf("%v", etcd.IsOptsWithPrefix([]etcd.OpOption{etcd.WithPrefix()}))
}

Logs false instead of true

Anything else we need to know?

IsOptsWithPrefix creates an empty op with NewOp which sets a key with len 0. Therefore the len check in WithPrefix also is true and the flag is not set.

Etcd version (please run commands below)

Not related to etcd backend, only client. Tested versions: v3.5.4, v3.6.0-alpha.0

Etcd configuration (command line flags or environment variables)

No response

Etcd debug information (please run commands blow, feel free to obfuscate the IP address or FQDN in the output)

No response

Relevant log output

No response

@spzala
Copy link
Member

spzala commented Jun 29, 2022

I could reproduce it. Working on fix.

spzala added a commit to spzala/etcd that referenced this issue Jun 29, 2022
Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes etcd-io#14056
spzala added a commit to spzala/etcd that referenced this issue Jun 29, 2022
Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes etcd-io#14056
spzala added a commit to spzala/etcd that referenced this issue Jun 29, 2022
Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes etcd-io#14056

Signed-off-by: Sahdev Zala <[email protected]>
spzala added a commit to spzala/etcd that referenced this issue Jun 29, 2022
Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes etcd-io#14056

Signed-off-by: Sahdev Zala <[email protected]>
spzala added a commit to spzala/etcd that referenced this issue Jul 2, 2022
Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes etcd-io#14056

Signed-off-by: Sahdev Zala <[email protected]>
spzala added a commit to spzala/etcd that referenced this issue Jul 3, 2022
Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes etcd-io#14056

Signed-off-by: Sahdev Zala <[email protected]>
spzala added a commit to spzala/etcd that referenced this issue Jul 3, 2022
Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes etcd-io#14056

Signed-off-by: Sahdev Zala <[email protected]>
spzala added a commit to spzala/etcd that referenced this issue Jul 3, 2022
Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes etcd-io#14056

Signed-off-by: Sahdev Zala <[email protected]>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/etcd that referenced this issue Oct 7, 2022
Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes etcd-io#14056

Signed-off-by: Sahdev Zala <[email protected]>
tjungblu pushed a commit to tjungblu/etcd that referenced this issue Jul 26, 2023
Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes etcd-io#14056

Signed-off-by: Sahdev Zala <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants