-
Notifications
You must be signed in to change notification settings - Fork 113
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
Improve fake server interface #3698
Improve fake server interface #3698
Conversation
config/testutils/fake_cloud.go
Outdated
@@ -42,10 +44,12 @@ type configAndCerts struct { | |||
} | |||
|
|||
// NewFakeCloudServer creates and starts a new grpc server for the Viam Cloud. | |||
func NewFakeCloudServer(ctx context.Context, logger logging.Logger) (*FakeCloudServer, error) { | |||
func NewFakeCloudServer(t *testing.T, ctx context.Context, logger logging.Logger) (*FakeCloudServer, func()) { //revive:disable-line:context-as-argument |
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.
side note, I tried to configure this rule globally (allowing *testing.T
to come before context.Context
) in etc/.golangci.yaml
but was unsuccessful. If others agree / know how to do this please share!
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.
so I figured out how to configure this rule globally, but it has the side-effect of turning all other revive rules. furthermore, enable all rules explicitly seems to cause a panic due to lack of defaults 😞
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.
this turned into a rabbit hole... I think the problem i was describing goes away if we use a later version of revive, but there's another issue apparently: golangci/golangci-lint#4353
not worth the hassle right now, just sticking with a //nolint:revive
1bb0195
to
36654a2
Compare
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.
This is a great cleanup
Makes start-up test checks internal to the
NewFakeCloudServer
test helper. These checks are necessary but distracting from the tests in which this utility is used.More generally follows this proposed pattern for test helpers