-
Notifications
You must be signed in to change notification settings - Fork 39
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
[controller] unwrap errors from m3admin #97
Conversation
We were checking against the wrapped errors which caused the placement and namespace controller actions to behave incorrectly.
|
||
placementMock.EXPECT().Get().Return(nil, errors.New("foo")) | ||
err = controller.EnsurePlacement(cluster) | ||
assert.Error(t, err) |
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.
nit: assert.Error(t, controller.EnsurePlacement(cluster))
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.
Hmm I worry about breaking convention with the style in the rest of our tests. Also personally I like having the error separate, if you're debugging a test it's easier to do something like fmt.Printf("%#v", err)
without having to pull it out of the assert
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.
Okay that's fair 👍
pkg/controller/add_cluster_test.go
Outdated
err = controller.EnsurePlacement(cluster) | ||
assert.NoError(t, err) | ||
|
||
placementMock.EXPECT().Get().Return(nil, errors.New("foo")) |
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.
I would avoid the foo
error messages and put in an actual error message. It would make understanding the tests much easier for people like me :)
|
||
placementMock.EXPECT().Get() | ||
err = controller.EnsurePlacement(cluster) | ||
assert.NoError(t, err) |
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.
Same as below
placementMock.EXPECT().Init(gomock.Any()) | ||
|
||
err = controller.EnsurePlacement(cluster) | ||
assert.NoError(t, err) |
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.
Same as below
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
Codecov Report
@@ Coverage Diff @@
## master #97 +/- ##
=========================================
Coverage ? 67.16%
=========================================
Files ? 26
Lines ? 1864
Branches ? 0
=========================================
Hits ? 1252
Misses ? 511
Partials ? 101 Continue to review full report at Codecov.
|
We were checking against the wrapped errors which caused the placement
and namespace controller actions to behave incorrectly.
Fixes #96