-
Notifications
You must be signed in to change notification settings - Fork 383
Clean-up after PR 3509 #3517
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
Clean-up after PR 3509 #3517
Conversation
da8b81b
to
0a6a9a1
Compare
Found it... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM just saw a test failing. plus some linting :
type `wsAdminClient` is unused (unused)
func `sendWsCloseMessage` is unused (unused)
@cesnietor These linter issues have already been fixed in commit 0a6a9a1. Not sure why you are still seeing them. Fixed |
Now disablebucket is failing :D @ramondeklein
|
@cesnietor Sorry, I didn't check it right. All checks now pass... |
This PR implements the following changes:
go test
due to parallelism).I was cleaning up the redundant code in upstream console and I noticed it was full of global variables for mocking. Global variables should be avoided and especially in Go unit tests, because tests may run in parallel when you run
go test ./...
. Unlesst.Parallel()
is called, tests within a single package run sequentially. But Go does run multiple packages in parallel, so it may be tricky when the mocked type is used in multiple packages.It's often easy to convert the globals to fields inside the struct, so I would propose to avoid global variables unless it's unavoidable. Made the change in console in this commit. Test code should mostly follow the same coding practices as normal code. We shouldn't be sloppy, because it's "just" test code.
PS: The mocking types were private, so I won't expect problems with the previous implementation. But it's often that a private type is made public later, so I rather keep code safe.