Filter instances on backend side#1491
Merged
NicolasMahe merged 12 commits intodevfrom Nov 14, 2019
Merged
Conversation
NicolasMahe
requested changes
Nov 8, 2019
NicolasMahe
reviewed
Nov 8, 2019
a3c0931 to
bedd3e0
Compare
Contributor
Author
|
I don't know why e2e fails, can you help me fix that? |
NicolasMahe
reviewed
Nov 11, 2019
Member
// Hash returns the calculate hash of a service.
func (s *SDK) Hash(req *api.CreateServiceRequest) (hash.Hash, error) {
var h hash.Hash
b, err := proto.Marshal(req)
if err != nil {
return nil, err
}
if err := s.client.Query("custom/"+backendName+"/hash", cmn.HexBytes(b), &h); err != nil {
return nil, err
}
return h, nil
}EDIT: i fixed it |
NicolasMahe
approved these changes
Nov 11, 2019
antho1404
requested changes
Nov 11, 2019
NicolasMahe
reviewed
Nov 13, 2019
NicolasMahe
approved these changes
Nov 13, 2019
antho1404
requested changes
Nov 14, 2019
Member
antho1404
left a comment
There was a problem hiding this comment.
Few issues while testing:
Crash
grpcurl -proto protobuf/api/instance.proto -plaintext localhost:50052 mesg.api.Instance/List
This crashes
panic: MarshalBinaryBare cannot marshal a nil pointer directly. Try wrapping in a struct?
Weird behavior with the filter
That might be related to grpcurl or base64 conversion but if I use the filter with slightly different values it still matches when it shouldn't
grpcurl -proto protobuf/api/instance.proto -plaintext -d "{\"filter\": {}}" localhost:50052 mesg.api.Instance/List
➜ engine git:(feature/filter-instance) grpcurl -proto protobuf/api/instance.proto -plaintext -d "{\"filter\": {}}" localhost:50052 mesg.api.Instance/List
{
"instances": [
{
"hash": "r1gIofZs2MZQVBsm6TGp5MGEoafY148TGNRJEnkvn1o=",
"serviceHash": "g6BhSw8QiSibfNkIIdkc5QRnhJVo4GJfE8QPcjKVP3I=",
"envHash": "T1PNoYwrqgwDVLtfmj7L5e0Sq02OEbqHPC8RFhICuUU="
}
]
}
# valid
grpcurl -proto protobuf/api/instance.proto -plaintext -d "{\"filter\": {\"serviceHash\": \"g6BhSw8QiSibfNkIIdkc5QRnhJVo4GJfE8QPcjKVP3I=\"}}" localhost:50052 mesg.api.Instance/List
# still valid by changing the last letter `I` per `J`.
grpcurl -proto protobuf/api/instance.proto -plaintext -d "{\"filter\": {\"serviceHash\": \"g6BhSw8QiSibfNkIIdkc5QRnhJVo4GJfE8QPcjKVP3J=\"}}" localhost:50052 mesg.api.Instance/List
cfbebe2 to
c844f60
Compare
Contributor
Author
|
Fixed issues with panic. Also add e2e tests for different instance hash and it works as expected. I'm not going to debug grpcurl as it is just a helper tool. From e2e tests and code perespective everything work fine. |
antho1404
approved these changes
Nov 14, 2019
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
clsoes #1467