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

[controller] unwrap errors from m3admin #97

Merged
merged 3 commits into from
Mar 1, 2019

Conversation

schallert
Copy link
Collaborator

@schallert schallert commented Mar 1, 2019

We were checking against the wrapped errors which caused the placement
and namespace controller actions to behave incorrectly.

Fixes #96

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)

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))

Copy link
Collaborator Author

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

Choose a reason for hiding this comment

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

Okay that's fair 👍

err = controller.EnsurePlacement(cluster)
assert.NoError(t, err)

placementMock.EXPECT().Get().Return(nil, errors.New("foo"))

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)

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)

Choose a reason for hiding this comment

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

Same as below

Copy link
Contributor

@CK-Ward CK-Ward left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Mar 1, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@f3264df). Click here to learn what that means.
The diff coverage is 66.66%.

Impacted file tree graph

@@            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.

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

@schallert schallert merged commit 34246d3 into master Mar 1, 2019
@schallert schallert deleted the schallert/unwrap_m3admin_errs branch March 1, 2019 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants