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: fix check for WithPrefix op #14182

Merged
merged 1 commit into from
Jun 29, 2022
Merged

Conversation

spzala
Copy link
Member

@spzala spzala commented Jun 29, 2022

Make sure that WithPrefix correctly set the flag, and add test.
Also, add test for WithFromKey.

fixes #14056

@spzala
Copy link
Member Author

spzala commented Jun 29, 2022

cc @serathius @ptabor @ahrtr

client/v3/op.go Outdated
@@ -391,6 +391,7 @@ func WithPrefix() OpOption {
return func(op *Op) {
if len(op.key) == 0 {
op.key, op.end = []byte{0}, []byte{0}
op.isOptsWithPrefix = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comment: Both line 394 and 397 set isOptsWithPrefix as true, so I suggest to move op.isOptsWithPrefix = true to the beginning of the function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahrtr Good catch, I missed it. Thanks!

@codecov-commenter
Copy link

codecov-commenter commented Jun 29, 2022

Codecov Report

Merging #14182 (8637c54) into main (7a1cecd) will decrease coverage by 0.23%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main   #14182      +/-   ##
==========================================
- Coverage   75.47%   75.23%   -0.24%     
==========================================
  Files         455      455              
  Lines       36846    36846              
==========================================
- Hits        27808    27722      -86     
- Misses       7314     7381      +67     
- Partials     1724     1743      +19     
Flag Coverage Δ
all 75.23% <100.00%> (-0.24%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
client/v3/op.go 74.71% <100.00%> (-1.15%) ⬇️
server/proxy/grpcproxy/register.go 69.76% <0.00%> (-20.94%) ⬇️
server/auth/simple_token.go 80.00% <0.00%> (-8.47%) ⬇️
client/pkg/v3/tlsutil/tlsutil.go 83.33% <0.00%> (-8.34%) ⬇️
client/v3/leasing/util.go 91.66% <0.00%> (-6.67%) ⬇️
client/v3/namespace/watch.go 87.87% <0.00%> (-6.07%) ⬇️
raft/rafttest/node.go 95.00% <0.00%> (-5.00%) ⬇️
client/v3/concurrency/session.go 88.63% <0.00%> (-4.55%) ⬇️
client/v3/leasing/cache.go 87.77% <0.00%> (-3.89%) ⬇️
client/pkg/v3/testutil/recorder.go 76.27% <0.00%> (-3.39%) ⬇️
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a1cecd...8637c54. Read the comment docs.

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 <spzala@us.ibm.com>
Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@spzala
Copy link
Member Author

spzala commented Jun 29, 2022

@ahrtr @serathius thanks for the quick review! Build is green so merging.

@spzala spzala merged commit 2a0e92f into etcd-io:main Jun 29, 2022
ahrtr added a commit that referenced this pull request Jul 3, 2022
…-upstream-release-3.5

Automated cherry pick of #14182
@serathius serathius mentioned this pull request Jul 6, 2022
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Client: IsOptsWithPrefix returns false even if WithPrefix() is included
4 participants