-
Notifications
You must be signed in to change notification settings - Fork 13
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
Filter instances on backend side #1491
Conversation
a3c0931
to
bedd3e0
Compare
I don't know why e2e fails, can you help me fix that? |
// 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 |
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.
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
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. |
clsoes #1467