-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add grpc-gateway tests for all APIv3 methods (#5051)
## Which problem is this PR solving? - Part of #5052 - Continuation of #5046 ## 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 --------- Signed-off-by: Yuri Shkuro <github@ysh.us>
- Loading branch information
1 parent
54f45e6
commit bdd43f7
Showing
14 changed files
with
353 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
cmd/query/app/apiv3/snapshots/TestGRPCGatewayWithBasePathAndTLS_FindTraces.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"result": { | ||
"resourceSpans": [ | ||
{ | ||
"resource": {}, | ||
"scopeSpans": [ | ||
{ | ||
"scope": {}, | ||
"spans": [ | ||
{ | ||
"endTimeUnixNano": "11651379494838206464", | ||
"name": "foobar", | ||
"spanId": "AAAAAAAAALQ=", | ||
"startTimeUnixNano": "11651379494838206464", | ||
"status": {}, | ||
"traceId": "AAAAAAAAAJYAAAAAAAAAoA==" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
cmd/query/app/apiv3/snapshots/TestGRPCGatewayWithBasePathAndTLS_GetOperations.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"operations": [ | ||
{ | ||
"name": "get_users", | ||
"spanKind": "server" | ||
} | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
cmd/query/app/apiv3/snapshots/TestGRPCGatewayWithBasePathAndTLS_GetServices.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"services": [ | ||
"foo" | ||
] | ||
} |
24 changes: 24 additions & 0 deletions
24
cmd/query/app/apiv3/snapshots/TestGRPCGatewayWithBasePathAndTLS_GetTrace.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"result": { | ||
"resourceSpans": [ | ||
{ | ||
"resource": {}, | ||
"scopeSpans": [ | ||
{ | ||
"scope": {}, | ||
"spans": [ | ||
{ | ||
"endTimeUnixNano": "11651379494838206464", | ||
"name": "foobar", | ||
"spanId": "AAAAAAAAALQ=", | ||
"startTimeUnixNano": "11651379494838206464", | ||
"status": {}, | ||
"traceId": "AAAAAAAAAJYAAAAAAAAAoA==" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
cmd/query/app/apiv3/snapshots/TestGRPCGatewayWithTenancy_FindTraces.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"result": { | ||
"resourceSpans": [ | ||
{ | ||
"resource": {}, | ||
"scopeSpans": [ | ||
{ | ||
"scope": {}, | ||
"spans": [ | ||
{ | ||
"endTimeUnixNano": "11651379494838206464", | ||
"name": "foobar", | ||
"spanId": "AAAAAAAAALQ=", | ||
"startTimeUnixNano": "11651379494838206464", | ||
"status": {}, | ||
"traceId": "AAAAAAAAAJYAAAAAAAAAoA==" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
cmd/query/app/apiv3/snapshots/TestGRPCGatewayWithTenancy_GetOperations.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"operations": [ | ||
{ | ||
"name": "get_users", | ||
"spanKind": "server" | ||
} | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
cmd/query/app/apiv3/snapshots/TestGRPCGatewayWithTenancy_GetServices.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"services": [ | ||
"foo" | ||
] | ||
} |
Oops, something went wrong.