-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Separate query-service functionality from http handler #1312
Separate query-service functionality from http handler #1312
Conversation
Signed-off-by: Annanay <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #1312 +/- ##
======================================
Coverage 100% 100%
======================================
Files 162 163 +1
Lines 7364 7374 +10
======================================
+ Hits 7364 7374 +10
Continue to review full report at Codecov.
|
Signed-off-by: Annanay <[email protected]>
Thanks for the review, @yurishkuro I've addressed comments and updated the PR. (A few failing tests will be fixed soon). |
Signed-off-by: Annanay <[email protected]>
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 looks pretty good, no major comments
Signed-off-by: Annanay <[email protected]>
A couple of things I came across as I'm fixing the test cases after refactoring.
... are going to change to -
And so we either need:
OR
.. (if we don't go with implementing a mock for QueryService)
@yurishkuro could you please review? |
On the first question, initTestServer is the one that creates and returns the mocks for storage. It should continue doing that. The tests are testing the handler endpoints, they don't care if internally the init function constructs QueryService. It seems like I'm missing something that's confusing you. On the second question, you need to make the fields of the options struct public, since they are part of the public API of the package. |
Signed-off-by: Annanay <[email protected]>
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.
a couple minor nits, ready to merge otherwise
Signed-off-by: Annanay <[email protected]>
Signed-off-by: Annanay <[email protected]>
Signed-off-by: Annanay <[email protected]>
@yurishkuro One test is failing because the |
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.
One test is failing because the querysvc directory doesn't have a test file. Not sure what to do here.
ideally, we should add tests, it's a simple one to test with mocks.
Signed-off-by: Annanay <[email protected]>
Signed-off-by: Annanay <[email protected]>
I've added an empty test for now because we have all the mock-tests in place for the reader/writer handlers anyway. Could you re-run travis on this @yurishkuro? The build seems to be failing with an unrelated error. |
@annanay25 there is a drop in code coverage, which shouldn't happen with plain refactoring. Could you find a way to bring coverage back? |
Looking into this. |
Signed-off-by: Annanay <[email protected]>
Signed-off-by: Annanay <[email protected]>
Signed-off-by: Annanay <[email protected]>
Signed-off-by: Annanay <[email protected]>
Signed-off-by: Annanay <[email protected]>
Signed-off-by: Annanay <[email protected]>
@yurishkuro Build is green :) |
@yurishkuro can we go ahead with this? |
cmd/query/app/http_handler_test.go
Outdated
handler.RegisterRoutes(r) | ||
return httptest.NewServer(r), readStorage, dependencyStorage, handler | ||
} | ||
|
||
func initializeTestServerWithQueryOptions(queryOptions querysvc.QueryServiceOptions, options ...HandlerOption) (*httptest.Server, *spanstoremocks.Reader, *depsmocks.Reader) { |
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 identical to initializeTestServerWithOptions, please remove
Signed-off-by: Annanay <[email protected]>
🎉 🎈 |
Thanks Yuri! 😄 |
Signed-off-by: Annanay [email protected]
Which problem is this PR solving?
Short description of the changes