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

Refactor/guble 24 public router interface #46

Merged
merged 15 commits into from
May 24, 2016

Conversation

bogh
Copy link
Collaborator

@bogh bogh commented May 23, 2016

No description provided.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 74.495% when pulling 7f38e55 on refactor/guble-24-public-router-interface into 325ff33 on master.

routerMock.EXPECT().KVStore().Return(store.NewMemoryKVStore(), nil)
routerMock.EXPECT().AccessManager().Return(amMock, nil).MaxTimes(2)
routerMock.EXPECT().MessageStore().Return(msMock, nil).MaxTimes(2)
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe it would be better to have a had written struct based implementation of the router interface for testing,
then I could write something like
routerMock := routerMock{MessageStore: NewMockMessageStore(mockCtrl), ...}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is good point. Want this now in this PR?

Copy link
Owner

Choose a reason for hiding this comment

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

I prefer to have all things done before merging,
but if you prefer, I also can merge directly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will add this first.

I have an idea here to extend the mock from the current mock generated in which the call to these methods return the supplied objects.

Copy link
Collaborator Author

@bogh bogh May 24, 2016

Choose a reason for hiding this comment

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

There is a problem with this. Here I'm testing something in gubled using a mock from server (RouterMock). Re your comment above this means I should either:

  • create a RouterMock inside the gubled package in a _test.go file and it will be visible only here.
  • create a public RouterMock in the server package and use it in other packages.

The other solution is to leave it as is, and everyone would supply the arguments according to the test.

Copy link
Owner

Choose a reason for hiding this comment

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

Would be the same with the generated mock.
I would never leave the mock code in the production code, so I see two possible solutions:

  1. have the mock redundant in the _test.go code of each package, where we need it
  2. Create a separate test_util package

In this small case I would prefer the redundancy variant.

@smancke
Copy link
Owner

smancke commented May 23, 2016

It was a good decision to make this change: Make the code much simpler.
I had only minimal comments. Also the Build job is failing, because of coverage processing.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 74.495% when pulling 5ef0199 on refactor/guble-24-public-router-interface into 325ff33 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 75.179% when pulling 1f658a0 on refactor/guble-24-public-router-interface into e1f35e1 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 75.179% when pulling 5f122aa on refactor/guble-24-public-router-interface into e1f35e1 on master.

@smancke
Copy link
Owner

smancke commented May 24, 2016

I would merge it now, but the build fails.

@bogh
Copy link
Collaborator Author

bogh commented May 24, 2016

The build fails, but for us works ok locally. We will focus on test fixing from now in next PR's.

@smancke smancke merged commit 2bc1e05 into master May 24, 2016
@bogh bogh deleted the refactor/guble-24-public-router-interface branch May 24, 2016 13:20
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