Hi @ngruson
Welcome to the community forum
I’m not sure where the issue lies in your case. I tested a similar example:
import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';
const data = JSON.parse(open('./requests/hello.json'));
const client = new grpc.Client();
client.load(['definitions'], 'hello.proto');
export default () => {
client.connect('grpcb.in:9000', {
plaintext: true
});
const response = client.invoke('hello.HelloService/SayHello', data);
check(response, {
'status is OK': (r) => r && r.status === grpc.StatusOK,
});
console.log(JSON.stringify(response.message));
client.close();
sleep(1);
};
With the file in ./requests/hello.json
{
"greeting": "Bert"
}
And the definitions/hello.proto
syntax = "proto2";
package hello;
service HelloService {
rpc SayHello(HelloRequest) returns (HelloResponse);
rpc LotsOfReplies(HelloRequest) returns (stream HelloResponse);
rpc LotsOfGreetings(stream HelloRequest) returns (HelloResponse);
rpc BidiHello(stream HelloRequest) returns (stream HelloResponse);
}
message HelloRequest {
optional string greeting = 1;
}
message HelloResponse {
required string reply = 1;
}
And the results look good:
I would start by testing the same example, which should work.
The differences can lie under your grpc service at localhost:9092
. I would recommend you try to troubleshoot as described in GRPC load testing with K6 - #3 by eyeveebee. The grpcurl
command comes in handy to help you first test your endpoint. And if that works, we can compare it with what k6 is sending.
I hope this helps
Cheers!