-
Notifications
You must be signed in to change notification settings - Fork 103
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
feat(x/data): query iri by hash cli and rest endpoint #1107
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1107 +/- ##
==========================================
+ Coverage 68.44% 68.95% +0.50%
==========================================
Files 212 213 +1
Lines 21390 21742 +352
==========================================
+ Hits 14641 14992 +351
+ Misses 5425 5418 -7
- Partials 1324 1332 +8
Flags with carried forward coverage won't be shown. Click here to find out more. |
cc @paul121 if you want to take a look as well. |
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.
lgtm
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.
pre-approving, few nits 👍🏻
content.json
Outdated
{ | ||
"graph": { | ||
"hash": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=", | ||
"digest_algorithm": "DIGEST_ALGORITHM_BLAKE2B_256", |
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.
👀
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.
require.Error(err) | ||
require.Contains(string(bz), tc.errMsg) |
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.
should be able to use ErrorContains
here
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.
bz
is the response from GetRequest
so we are checking if the error message is within the get response. The err
above is from UnmarshalJSON
. ErrorContains
requires an error
type and cannot be used with json.
require.Error(err) | ||
require.Contains(string(bz), tc.errMsg) |
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.
ditto
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.
Same as above. We need to check if the response contains the error message.
x/data/client/testsuite/grpc.go
Outdated
// encode base64 bytes to base64 string | ||
encodedHash := base64.StdEncoding.EncodeToString(decodedHash) | ||
// replace all instances of "+" with "%2b" | ||
return strings.Replace(encodedHash, "+", "%2b", -1) |
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.
just curious, why do we do the replace?
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.
For REST endpoints, we cannot use +
in the param value so it needs to be encoded.
Description
Closes: #1087
This pull request adds a CLI command to query IRI by content hash using a json file as well as the ability to query IRI by raw and graph content hash properties using a gRPC REST endpoint.
CLI Command
REST Endpoints
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change