Skip to content

Conversation

yurishkuro
Copy link
Member

@yurishkuro yurishkuro commented Dec 27, 2023

Which problem is this PR solving?

Description of the changes

  • Add tests for all HTTP APIs, not just GetTrace
  • Use snapshots to make validation of HTTP/JSON response from the server easier
  • Replace grpc-gateway/runtime JSONPb marshaler (in tests) with gogo/jsonpb marshaler

Gaps

  • The error conditions are not being tested currently, such as not specifying the timestamps in the query

How was this change tested?

  • Unit tests

@yurishkuro yurishkuro added the changelog:test Change that's adding missing tests or correcting existing tests label Dec 27, 2023
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Copy link

codecov bot commented Dec 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (54f45e6) 95.53% compared to head (4ac994b) 95.53%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5051      +/-   ##
==========================================
- Coverage   95.53%   95.53%   -0.01%     
==========================================
  Files         313      313              
  Lines       18161    18160       -1     
==========================================
- Hits        17350    17349       -1     
  Misses        649      649              
  Partials      162      162              
Flag Coverage Δ
cassandra-3.x 25.61% <ø> (ø)
cassandra-4.x 25.61% <ø> (ø)
elasticsearch-5.x 19.88% <ø> (ø)
elasticsearch-6.x 19.88% <ø> (+0.01%) ⬆️
elasticsearch-7.x 20.00% <ø> (-0.02%) ⬇️
elasticsearch-8.x 20.11% <ø> (+0.01%) ⬆️
grpc-badger 19.50% <ø> (ø)
kafka 14.10% <ø> (ø)
opensearch-1.x 20.00% <ø> (ø)
opensearch-2.x 20.02% <ø> (+0.01%) ⬆️
unittests 93.19% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

t.Run("FindTraces", func(t *testing.T) {
runGatewayFindTraces(t, gw, setupRequest)
})
}
Copy link
Member Author

@yurishkuro yurishkuro Dec 27, 2023

Choose a reason for hiding this comment

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

@albertteoh this was the point of cleaning up tests - now they are testing all gateway APIs and we can try things like upgrading the gateway dep to v2.x or completely re-implementing it. My next step would be to try an upgrade, which requires building a new protoc image that I just kicked off (takes 4hrs to build), and maybe with v2 gateway we could find a way to integrate gogo marshaling.

@yurishkuro yurishkuro marked this pull request as ready for review December 27, 2023 23:04
@yurishkuro yurishkuro requested a review from a team as a code owner December 27, 2023 23:04
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Copy link
Contributor

@jkowall jkowall left a comment

Choose a reason for hiding this comment

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

looks good to me.

@yurishkuro yurishkuro merged commit bdd43f7 into jaegertracing:main Dec 28, 2023
@yurishkuro yurishkuro deleted the grpc-gateway-tests branch December 28, 2023 02:47
yurishkuro added a commit that referenced this pull request Dec 30, 2023
## Which problem is this PR solving?
- Part of #5052

## Description of the changes
- Pull in IDL change
jaegertracing/jaeger-idl#102
- Re-implement APIv3 HTTP endpoints without the use of grpc-gateway
- Share tests from grpc-gateway for manual implementation
  - Refactor tests to avoid duplication of snapshots
- Fix inconsistency between http and grpc tenancy interceptors where
HTTP was returning Unauthenticated in certain cases, but GRPC was always
returning Forbidden. Make them consistent: missing tenant header results
in Unauthenticated.

## Follow-ups
- [x] http implementation needs more unit tests (mostly error handling
and parameter variations)
- [ ] the new implementation is not hooked up into production code yet,
I first want to confirm it works with model-v2, and just in general
minimize the scope of a single PR

## How was this change tested?
- Using unit tests added in #5051, with additional enhancements

---------

Signed-off-by: Yuri Shkuro <github@ysh.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:test Change that's adding missing tests or correcting existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants