Skip to content
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

grpc module is not registering protobuf nested messages #3160

Closed
thiagodpf opened this issue Jul 4, 2023 · 11 comments · Fixed by #3178
Closed

grpc module is not registering protobuf nested messages #3160

thiagodpf opened this issue Jul 4, 2023 · 11 comments · Fixed by #3178
Assignees

Comments

@thiagodpf
Copy link
Contributor

Hey folks!

I noticed that modules k6/net/grpc and k6/experimental/grpc are not registering the nested types defined in my .proto file. This means that when receiving the response (via stream) from the server, it is not possible to generate a javascript object via marshaling (and thus I am not able to proceed with the load test).

I've been debugging the code and saw that the fix could be made at this point (based on the module k6/experimental/grpc):

messages := fd.Messages()
for i := 0; i < messages.Len(); i++ {
message := messages.Get(i)
_, errFind := protoregistry.GlobalTypes.FindMessageByName(message.FullName())
if errors.Is(errFind, protoregistry.NotFound) {
err = protoregistry.GlobalTypes.RegisterMessage(dynamicpb.NewMessageType(message))
if err != nil {
return false
}
}
}

Note that the above algorithm only goes through the first level messages of the .proto file, but it is possible that a message has a list of nested messages and so on recursively. It is possible to adjust the algorithm to traverse the data structure (tree) without the need to perform a recursion, although a recursion would be much simpler, since nobody defines so many nested levels.

Do you already have this fix mapped out to be resolved or can I propose a Pull Request?

@mstoykov
Copy link
Collaborator

mstoykov commented Jul 4, 2023

Hi @thiagodpf, thanks for reporting this 🙇

This seems like a big miss on our side, at least at first glance.

Are nested types used often? Are they a new feature, by any chance? This code is also a little over a year old which seems like this is just not used all that much 🤔 ?

I am mostly asking to know just how likely is we have broken something instead of it just not working ever and nobody has been using it. I expect that later is the case, so I will mark this is an enhancement.

Do you already have this fix mapped out to be resolved or can I propose a Pull Request?

I don't think someone has reported this before or that we have started a fix. A PR is welcome here, if you want to do it.

I would probably propose doing it against the xk6-grpc repo, and we can transfer it in standard after that (potentially even in the same release).
Also, please add tests for this behaviour.

Thanks again for the reporting this 🙇

@thiagodpf
Copy link
Contributor Author

I think nested types have been supported in protobuf for some time now, but in practice it's hard to see anyone use it. I don't use it myself, but I decided to take advantage of a googleapis-rpc error_details.proto for error handling and that googleapis .proto uses nested types.

I think the problem only happens when using the google.protobuf.Any type, according to the PR you mentioned. Since the marshaling functionality will fetch the type information from the Registry when it encounters a field of type google.protobuf.Any.

Here's an example:
As the nested type FieldViolation (type.googleapis.com/google.rpc.BadRequest.FieldViolation) is not being registered in the protoregistry (in that for loop I highlighted in the previous message), an error occurs within the marshaling library, as seen in the following image:
image

The error in the image above means that the response received via Stream is not forwarded to the javascript (since it was not possible to marshal the json fragment of the google.protobuf.Any field):
image

If I don't run k6 in --verbose mode, I'm not aware that the error has occurred. I only realized this because I noticed that the listener for the data event was not being called:

  // ...in my load test script...
  stream.on('data', (response) => {
    console.log("Response arrived") // <-- this log was not being called
    console.log(response)
  });

@thiagodpf
Copy link
Contributor Author

That said, I'm going to propose via PR a change to this code snippet to consider nested messages as well:
https://github.com/grafana/xk6-grpc/blob/main/grpc/client.go#L285-L295

Do you have a preference for the type of algorithm for traversing nested types? I can avoid a recursive function using a "Queue" or "Stack" (like those algorithms used to traverse graphs), but I think a recursion would be simpler to read, and also because so many levels of nested types in .proto files are not common...

@mstoykov
Copy link
Collaborator

mstoykov commented Jul 4, 2023

I am not certain how you got the logged line you got.

Looking at the code
https://github.com/grafana/xk6-grpc/blob/6095be08a1f0c2ef484a39b94a14c279bde1c393/grpc/stream.go#L176-L198

It seems to me you eitehr should have error while reading from the stream or `stream is cancelled/finished'.

cc @olegbespalov

Do you have a preference for the type of algorithm for traversing nested types?

I don't think it matters so much. I do feel like having it be none recursive is actually going to be just as much code, but I propose you just do it, and we can figure out if it makes sense.

also because so many levels of nested types in .proto files are not common...

I have no idea - if we expect no more then 2-3 levels and at 10 we have practically no examples 👍 .

I am not certain at what level this will be a problem either way, as I expect reading and parsing such a deeply neseted proto buf file is likely going to be more problematic then our handling of it 🤷

@thiagodpf
Copy link
Contributor Author

🔹 About this:

I am not certain how you got the logged line you got.

I only got that log because I was debugging the code to understand what was going on. Actually I forced that log in the terminal debugging through VSCode: call errConv.Error(). 😅

If I run k6 in --verbose mode, the log I would get would look like this:

DEBU[0005] error while reading from the stream           error="failed to marshal the message: proto:\u00a0google.protobuf.Any: unable to resolve \"type.googleapis.com/google.rpc.BadRequest.FieldViolation\": not found"

🔹 About algorithm to traverse nested message structure, I will propose something tonight ✌️😁

@thiagodpf
Copy link
Contributor Author

@mstoykov I believe that I will need your guidance to proceed with the tests, in order to be able to reproduce (in the xk6-grpc repo) the problem I reported.

TL;DR Could you tell me if there are test cases in which the process that runs the gRPC server is different from the process that runs the client? It seems to me that this code here (which represents the gRPC server) should run separately from the client, right? Could I run a test case that makes use of this server?


Long story, go get a coffee and clear your mind to try to understand the problem...

So that I can reproduce the error I'm having, I need to find a test scenario that takes me closer to that of real k6, where I only need to inform the .proto files and k6 loads them, without the code generated from the .proto.
In practice, k6 does not have access to the code generated from the proto file, we just inform (in the test scripts) where the .proto file is located and k6 knows how to load them (and register de messages via protoregistry.GlobalTypes here).

I think it will be difficult for me to explain this (and I already see myself repeating the same thing), but... 😅
for the problem to be reproducible in a test environment, the code generated from the .proto cannot be part of the "k6" binary, that is, I need a test scenario in which the code generated from .proto is only on the server side, and k6 only has access to the .proto file in fact. In short, I need a way to separate the server side from the client side into different binaries.
this because there are init() functions in the "proto-generated" code that are executed as soon as the binary is loaded (this behavior is part of the golang package definition).

Here's an init() example of what I'm referring to!

If this init() above is executed on the client side (i.e. on K6) it does not represent the actual use of the software.
This means that this line of code (client side) is never executed in test environment (but in production it does!!!), as the if condition (protoregistry.NotFound) will never be true (because the damn init() already registered the message types in the protoregistry.GlobalTypes).

For it to be true (that is: the message types have not yet been registered in the protoregistry.GlobalTypes), it is necessary that the binaries of the "proto-generated" code from the .proto file not be part of the client binary (i.e. k6), they should only stay on the server.

I'm sorry for being so long-winded, but do you get the idea?
Are there any test cases that take me the closest to what I described above?

@thiagodpf
Copy link
Contributor Author

just to put you in context, I tried running this test file and it didn't work because it runs the client and server on the same binary.

@mstoykov
Copy link
Collaborator

mstoykov commented Jul 5, 2023

@thiagodpf good catch 🙇 - yeah, turns out that the tests for this functionality don't really do anything at this point.

After a quick internal discussion we do think that:

  1. we should fix it - possibly with having a separate CI action to do this. Which has the problems that go test ./... will not catch it :(
  2. we likely won't prioritize it high enough right away
  3. we likely will first do it in xk6-grpc repo
  4. we don't want this to block you

So our proposal is that:

  1. you go ahead and do the code.
  2. preferably still add unit tests that we will later fix (you can probably skip that for the first iteration - we might never user it and just use the next point)
  3. make a test server and client scripts as the ones in the examples folder that only work with the fix.

This way we can get the actual fix and later figure out the exact way to test it going forward.

You are also welcome to actually contribute a way to run the tests in separate processes.

@thiagodpf
Copy link
Contributor Author

Perfect! I will try to demonstrate the problem according to your guidance.

By the way, the branch I should use is the main? I ask this because I tried to run the xk6-grpc/grpc/client_test.go file unit tests and they failed. Looks like the repo is missing a directory structure...

Running tool: /usr/local/go/bin/go test -timeout 30s -run ^(TestClient|TestDebugStat)$ github.com/grafana/xk6-grpc/grpc

2023/07/05 10:06:51 http: TLS handshake error from 127.0.0.1:37952: remote error: tls: bad certificate
--- FAIL: TestClient (0.00s)
    --- FAIL: TestClient/Close (0.02s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/Close
    --- FAIL: TestClient/UnknownConnectParam (0.02s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/UnknownConnectParam
    --- FAIL: TestClient/LoadNotInit (0.00s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/LoadNotInit
    --- FAIL: TestClient/SentMessageLargerThanMax (0.02s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/SentMessageLargerThanMax
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	"GoError: method \"/grpc.testing.TestService/UnaryCall\" not found in file descriptors at reflect.methodValueCall (native)" does not contain "trying to send message larger than max"
            	Test:       	TestClient/SentMessageLargerThanMax
    --- FAIL: TestClient/RequestMessage (0.03s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/RequestMessage
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Received unexpected error:
            	            	GoError: method "/grpc.testing.TestService/UnaryCall" not found in file descriptors at reflect.methodValueCall (native)
            	Test:       	TestClient/RequestMessage
    --- FAIL: TestClient/ResponseTrailers (0.03s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/ResponseTrailers
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Received unexpected error:
            	            	GoError: method "/grpc.testing.TestService/EmptyCall" not found in file descriptors at reflect.methodValueCall (native)
            	Test:       	TestClient/ResponseTrailers
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:444
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:29
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Should be true
            	Test:       	TestClient/ResponseTrailers
            	Messages:   	url example.com:42957/grpc.testing.TestService/EmptyCall didn't emit grpc_req_duration
    --- FAIL: TestClient/ReceivedMessageLargerThanMax (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/ReceivedMessageLargerThanMax
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	"GoError: method \"/grpc.testing.TestService/UnaryCall\" not found in file descriptors at reflect.methodValueCall (native)" does not contain "received message larger than max"
            	Test:       	TestClient/ReceivedMessageLargerThanMax
    --- FAIL: TestClient/ResponseError (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/ResponseError
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Received unexpected error:
            	            	GoError: method "/grpc.testing.TestService/EmptyCall" not found in file descriptors at reflect.methodValueCall (native)
            	Test:       	TestClient/ResponseError
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:384
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:29
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Should be true
            	Test:       	TestClient/ResponseError
            	Messages:   	url example.com:42013/grpc.testing.TestService/EmptyCall didn't emit grpc_req_duration
    --- FAIL: TestClient/ResponseHeaders (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/ResponseHeaders
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Received unexpected error:
            	            	GoError: method "/grpc.testing.TestService/EmptyCall" not found in file descriptors at reflect.methodValueCall (native)
            	Test:       	TestClient/ResponseHeaders
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:414
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:29
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Should be true
            	Test:       	TestClient/ResponseHeaders
            	Messages:   	url example.com:33771/grpc.testing.TestService/EmptyCall didn't emit grpc_req_duration
    --- FAIL: TestClient/Connect (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/Connect
    --- FAIL: TestClient/InvokeAnyProto (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_any_testing/any_test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_any_testing/any_test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/InvokeAnyProto
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Received unexpected error:
            	            	GoError: method "/grpc.any.testing.AnyTestService/Sum" not found in file descriptors at reflect.methodValueCall (native)
            	Test:       	TestClient/InvokeAnyProto
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:282
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:29
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Should be true
            	Test:       	TestClient/InvokeAnyProto
            	Messages:   	url example.com:34933/grpc.any.testing.AnyTestService/Sum didn't emit grpc_req_duration
    --- FAIL: TestClient/Invoke (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/Invoke
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Received unexpected error:
            	            	GoError: method "/grpc.testing.TestService/EmptyCall" not found in file descriptors at reflect.methodValueCall (native)
            	Test:       	TestClient/Invoke
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:234
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:29
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Should be true
            	Test:       	TestClient/Invoke
            	Messages:   	url example.com:35457/grpc.testing.TestService/EmptyCall didn't emit grpc_req_duration
    --- FAIL: TestClient/NoConnect (0.00s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	"GoError: could not resolve path \"../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto\": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)" does not contain "invoking RPC methods in the init context is not supported"
            	Test:       	TestClient/NoConnect
    --- FAIL: TestClient/InvokeNilRequest (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/InvokeNilRequest
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	"GoError: method \"/grpc.testing.TestService/EmptyCall\" not found in file descriptors at reflect.methodValueCall (native)" does not contain "request cannot be nil"
            	Test:       	TestClient/InvokeNilRequest
    --- FAIL: TestClient/InvokeInit (0.00s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	"GoError: could not resolve path \"../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto\": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)" does not contain "invoking RPC methods in the init context is not supported"
            	Test:       	TestClient/InvokeInit
    --- FAIL: TestClient/ConnectInit (0.00s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:22
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	"GoError: could not resolve path \"../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto\": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)" does not contain "connecting to a gRPC server in the init context is not supported"
            	Test:       	TestClient/ConnectInit
    --- FAIL: TestClient/InvokeNotFound (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/InvokeNotFound
    --- FAIL: TestClient/Load (0.00s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/Load
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:25: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:25
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Expected value not to be nil.
            	Test:       	TestClient/Load
    --- FAIL: TestClient/ResponseMessage (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/ResponseMessage
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Received unexpected error:
            	            	GoError: method "/grpc.testing.TestService/UnaryCall" not found in file descriptors at reflect.methodValueCall (native)
            	Test:       	TestClient/ResponseMessage
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:52
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:356
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:29
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Should be true
            	Test:       	TestClient/ResponseMessage
            	Messages:   	url example.com:37779/grpc.testing.TestService/UnaryCall didn't emit grpc_req_duration
    --- FAIL: TestClient/ConnectIntegerTimeout (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/ConnectIntegerTimeout
    --- FAIL: TestClient/RequestHeaders (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/RequestHeaders
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:676
            	Error:      	Received unexpected error:
            	            	GoError: method "/grpc.testing.TestService/EmptyCall" not found in file descriptors at reflect.methodValueCall (native)
            	Test:       	TestClient/RequestHeaders
    --- FAIL: TestClient/ConnectFloatTimeout (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/ConnectFloatTimeout
    --- FAIL: TestClient/ConnectInvalidTimeout (0.00s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/ConnectInvalidTimeout
    --- FAIL: TestClient/ConnectStringTimeout (0.01s)
        /home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19: 
            	Error Trace:	/home/thiagodepaulaferreira/github/xk6-grpc/grpc/helpers_test.go:19
            	            				/home/thiagodepaulaferreira/github/xk6-grpc/grpc/client_test.go:672
            	Error:      	Received unexpected error:
            	            	GoError: could not resolve path "../vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto": open /home/thiagodepaulaferreira/github/xk6-grpc/vendor/go.k6.io/k6/lib/testutils/httpmultibin/grpc_testing/test.proto: no such file or directory at reflect.methodValueCall (native)
            	Test:       	TestClient/ConnectStringTimeout
FAIL
FAIL	github.com/grafana/xk6-grpc/grpc	1.035s
FAIL

@mstoykov
Copy link
Collaborator

mstoykov commented Jul 5, 2023

@thiagodpf I should've probably written you about this, but the xk6-grpc depends on you having vendored the dependencies. I did open an issue before responding even grafana/xk6-grpc#21.

So you can just run go mod vendor locally - we do this in the CI already.

Sorry for the inconvenience.

@thiagodpf
Copy link
Contributor Author

Very good tip! 🎉
I was able to better understand the unit tests after running the command. It helped a lot!

I proposed a PR on that repository, check it out when you can. If you want to debug to understand the algorithm, it's very easy, basically it's a traversal of a tree structure.

As for contributing ways to run the tests in separate processes, I'm afraid I'm not that familiar with github's CI 😅. But thank you for opening a point of discussion on the subject. 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants