GRPC response.the message is empty, although it should not be so according to the grpc protocol. I assume that the serialization in json is not configured correctly
the answer comes like this {‘value’: false}, but in the script the answer looks like this {}
Such functions cannot be tested:
rpc FooBar(FooBarRequest) returns (google.protobuf.BoolValue);
You can test at least status:
check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
});
What are you getting for:
console.log("GRPC response code: " + response.status + ", response body: " + JSON.stringify(response.message));
Yes, I have a check, it works.
check(response, {
"status is OK": (r) => r &&
r.status === grpc.StatusOK,
});
console.info("GRPC response code: " + response.status + ", response body: " + JSON.stringify(response.message));
console.info(`Response: ${JSON.stringify(response)}`)
Output the following:
GRPC response code: 0, response body: {}
Response: {"message":{},"error":null,"headers":{"content-type":["application/grpc"]},"trailers":{},"status":0}
maybe it makes sense to use protojson.UnmarshalOptions instead of json.Unmarshal to return?
Or maybe it’s related to google.protobuf.BoolValue
I wrote my service, and decided to test it:
service TestService {
rpc Foo(Request) returns (google.protobuf.BoolValue) {
option (google.api.http) = {
post: "/v1/test/foo"
body: "*"
};
}
rpc Bar(Request) returns (Response) {
option (google.api.http) = {
post: "/v1/test/bar"
body: "*"
};
}
}
message Request {
}
message Response {
bool value = 1;
}
INFO[0000] GRPC response code: 0, response body: {} source=console
INFO[0000] Foo Response: {"message":{},"error":null,"headers":{"content-type":["application/grpc"]},"trailers":{},"status":0} source=console
INFO[0000] GRPC response code: 0, response body: {"value":false} source=console
INFO[0000] Bar Response: {"message":{"value":false},"error":null,"headers":{"content-type":["application/grpc"]},"trailers":{},"status":0} source=console
Actually, this is the problem. Google/protobuf/wrappers.proto support is not implemented in K6
Hey @granj444
Sorry I’m not a heavy grpc user and don’t have an exact answer.
Yet, I believe you didn’t mention which grpc
module you were using: k6/net/grpc
I assume, but have you by any chance given a shot to the xk6-grpc extension?
@olegbespalov is not available at the moment, but when he becomes available again, he might be able to offer a more thorough answer.
If you’re relatively sure neither k6 nor the extension I mentioned support the feature you need yet, I invite you to open a feature request issue on our repository
Yes, I opened it. The problem is that k6 does not give an answer at all in this case. although it handles incoming messages well. The problem is only in the outgoing
Here is the link to the issue:
Google/protobuf/wrappers.proto support is not implemented in K6 · Issue #3232 · grafana/k6 · GitHub I was able to correct
This closes the problem:
Google/protobuf/wrappers.proto support is not implemented in K6 by zibul444 · Pull Request #3238 · grafana/k6 · GitHub