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

server: fix unexported-return lint issue #19052

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

aladesawe
Copy link
Contributor

@aladesawe aladesawe commented Dec 12, 2024

PR to fix unexported-return lint issues under the server folder as mentioned in Issue 18370.

This PR:

  • addresses the auth package, and uses the existing AuthStore interface as the type returned by NewAuthStore in the auth/store.go file
  • updates auth/store_test.go file to use the corresponding interface returned
  • updates adapters.go so that NewServerVersionAdapter returns serverversion.Server interface
  • creates an interface ApplierMembership for NewApplierMembership's return type
  • creates an interface StorageRecorder return type for NewStorageRecorder and NewStorageRecorderStream
  • disables unexported-return for the mvcc/kvstore.go NewStore function. It appears the function is used internally, opted to disable versus using type assertions in the mvcc package
  • moving WALVersion interface definition to the wal package, and using an alias in schema
  • and other interface updates

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

@k8s-ci-robot
Copy link

Hi @aladesawe. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ivanvc
Copy link
Member

ivanvc commented Dec 13, 2024

Hi, @aladesawe. Thanks for your pull request 🙇.

One of many PRs to fix unexported-return lint issues under the server folder as mentioned in #18370.

Do you know how many issues there are in server? If there are not too many, it may be better to open a single pull request. We ideally want to keep the PR under 100 or 200 lines.

Thanks, again.

@aladesawe
Copy link
Contributor Author

Hi, @aladesawe. Thanks for your pull request 🙇.

One of many PRs to fix unexported-return lint issues under the server folder as mentioned in #18370.

Do you know how many issues there are in server? If there are not too many, it may be better to open a single pull request. We ideally want to keep the PR under 100 or 200 lines.

Thanks, again.

Hello @ivanvc sure thing, I'll pull more updates into this PR. There are about 10 more files with the error under the server module.

@aladesawe aladesawe changed the title auth: fix unexported-return lint issue server: fix unexported-return lint issue Dec 15, 2024
@aladesawe aladesawe marked this pull request as ready for review December 16, 2024 22:08
@ivanvc
Copy link
Member

ivanvc commented Dec 18, 2024

/ok-to-test

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.85%. Comparing base (32cfd45) to head (66c71ea).
Report is 13 commits behind head on main.

Additional details and impacted files
Files with missing lines Coverage Δ
server/auth/store.go 83.79% <100.00%> (ø)
server/etcdserver/adapters.go 66.66% <100.00%> (ø)
server/etcdserver/apply/apply.go 78.02% <100.00%> (ø)
server/mock/mockstorage/storage_recorder.go 95.00% <100.00%> (ø)
server/storage/mvcc/kvstore.go 89.86% <ø> (ø)
server/storage/mvcc/watchable_store.go 93.89% <100.00%> (ø)
server/storage/schema/alarm.go 86.66% <100.00%> (ø)
server/storage/schema/auth.go 100.00% <100.00%> (ø)
server/storage/schema/membership.go 59.85% <100.00%> (ø)
server/storage/schema/schema.go 94.64% <ø> (-5.36%) ⬇️
... and 1 more

... and 29 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #19052      +/-   ##
==========================================
+ Coverage   68.83%   68.85%   +0.01%     
==========================================
  Files         420      420              
  Lines       35678    35680       +2     
==========================================
+ Hits        24560    24567       +7     
+ Misses       9688     9687       -1     
+ Partials     1430     1426       -4     

Continue to review full report in Codecov by Sentry.

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

@ivanvc
Copy link
Member

ivanvc commented Dec 19, 2024

/test pull-etcd-govulncheck

@ivanvc
Copy link
Member

ivanvc commented Jan 16, 2025

@aladesawe, I'm sorry it took me a while to respond to this pull request. I was out for the holidays and had a long backlog.

A heads up that I raised this question in a similar pull request: #19105 (comment)

Thanks for bearing with us :)

@aladesawe
Copy link
Contributor Author

@aladesawe, I'm sorry it took me a while to respond to this pull request. I was out for the holidays and had a long backlog.

A heads up that I raised this question in a similar pull request: #19105 (comment)

Thanks for bearing with us :)

No worries Ivan, understandable :). I see the comment, and will follow the conversation there.

Copy link
Member

@ivanvc ivanvc left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, @aladesawe.

Comment on lines 120 to 122
if !ok {
t.Fatal(errors.New("addUserWithNoOption: needs an AuthStore implementation"))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if !ok {
t.Fatal(errors.New("addUserWithNoOption: needs an AuthStore implementation"))
}
require.True(t, ok, "addUserWithNoOption: needs an AuthStore implementation")

Comment on lines 345 to 347
if !ok {
t.Fatal(errors.New("TestWatchNoEventLossOnCompact: needs a WatchableKV implementation"))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if !ok {
t.Fatal(errors.New("TestWatchNoEventLossOnCompact: needs a WatchableKV implementation"))
}
require.True(t, ok, "TestWatchNoEventLossOnCompact: needs a WatchableKV implementation")

Comment on lines 575 to 577
if !ok {
t.Fatal(errors.New("TestWatchBatchUnsynced: needs a WatchableKV implementation"))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if !ok {
t.Fatal(errors.New("TestWatchBatchUnsynced: needs a WatchableKV implementation"))
}
require.True(t, ok, "TestWatchBatchUnsynced: needs a WatchableKV implementation")

@aladesawe aladesawe requested a review from mmorel-35 January 27, 2025 04:44
@k8s-ci-robot
Copy link

@aladesawe: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-etcd-e2e-arm64 66c71ea link true /test pull-etcd-e2e-arm64
pull-etcd-e2e-386 66c71ea link true /test pull-etcd-e2e-386
pull-etcd-e2e-amd64 66c71ea link true /test pull-etcd-e2e-amd64

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aladesawe, ivanvc, mmorel-35
Once this PR has been reviewed and has the lgtm label, please assign serathius for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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.

4 participants