-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Google/protobuf/wrappers.proto support is not implemented in K6 #3238
Conversation
I could not write a test because protoparce give an error when importing package "google/protobuf/wrappers.proto";. I do not know how to solve this, I can send the code of the test itself, I rewrote the test of course. But I could not overcome the protoparce error |
test-current-cov |
What kind of error? Could you maybe commit the test (even if it's failing)
Unfortunately this is a flaky tests that is known, you could ignore this failure |
@@ -162,8 +162,11 @@ func (c *Conn) Invoke( | |||
// {"x":6,"y":4,"z":0} | |||
raw, _ := marshaler.Marshal(resp) | |||
msg := make(map[string]interface{}) | |||
_ = json.Unmarshal(raw, &msg) | |||
er := json.Unmarshal(raw, &msg) |
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.
I'm wondering if we could somehow identify that raw is a wrapped 🤔
Or, more precisely, I'm concerned that in case of Unmarshaling error, we safely assume that we can use raw
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.
unfortunately, I can't tell you exactly how this can be done, but I will accept any help. I will assume that it is possible, but if you complicate the checks, it can greatly affect performance - this is also bad.
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.
I find this fix ... strange at best and mostly hacky at this point.
I can't imagine that this is how it is supposed to work and also this will practically return you broken responses in case of real errors.
Additionally the lack of unit test for this means that I can't even easily check how this change at this point.
Can we please at least get a unit test for this.
@olegbespalov I guess you are trying to figure out how this is supposed to work actually ?
@fabiogoshippo, from the error, it seems your problem is either authentication or a different one, and anyway, the pull request isn't the best place to discuss it. Could you please open the topic (with all details and script without any business specific) on our community forums? We (or the community) will try to help you there. Thanks. |
yes, without this error, all other tests work.
The test crashes, because server emulation has not been performed, due to the lack of dependencies, maybe you can tell where exactly they are and how you can put them? |
@olegbespalov |
@zibul444 I mean, the end-goal is to have the test for the functionality, so even if it's failing, I guess it's OK to push it, I'll have a look at the code and maybe come up with the advice on how to resolve failure |
@@ -162,8 +162,11 @@ func (c *Conn) Invoke( | |||
// {"x":6,"y":4,"z":0} | |||
raw, _ := marshaler.Marshal(resp) | |||
msg := make(map[string]interface{}) | |||
_ = json.Unmarshal(raw, &msg) | |||
er := json.Unmarshal(raw, &msg) |
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.
nit: you should be able to assign to err
without :=
and without getting a complain about shadowing
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.
I don't know what you're talking about . Changing the variable name solves the shading problem. The err
variable already exists. What exactly did I do wrong?
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.
You should just assign this to err
instead of addng a new variable.
I don't se ay reason not to.
Added a test for the primitive in Test Invoke
Codecov Report
@@ Coverage Diff @@
## master #3238 +/- ##
==========================================
- Coverage 73.21% 73.10% -0.11%
==========================================
Files 259 257 -2
Lines 19897 19894 -3
==========================================
- Hits 14568 14544 -24
- Misses 4406 4421 +15
- Partials 923 929 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
I have added a test, but it is always with an error
I do not know how to add |
The xk6 tests are failing due to #3252 can you please rebase on top of the current Sorry for the inconvenience 🙇 |
@@ -162,8 +162,11 @@ func (c *Conn) Invoke( | |||
// {"x":6,"y":4,"z":0} | |||
raw, _ := marshaler.Marshal(resp) | |||
msg := make(map[string]interface{}) |
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.
Okay, I've looked into this and believe that this line is an issue, switching to this should help
msg := make(map[string]interface{}) | |
var msg interface{} |
@@ -24,26 +24,70 @@ import ( | |||
) | |||
|
|||
func TestInvoke(t *testing.T) { | |||
t.Parallel() | |||
ctx := context.Background() |
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.
I believe the https://github.com/grafana/k6/blob/master/js/modules/k6/grpc/client_test.go is the better test for testing this, and we might need to introduce one more test service, which could contain a different method to test the wrappers.
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.
There is an example of he fix + tests for the unary parts of the xk6-grpc module. I still need to do a couple of more commits related to the streaming API grafana/xk6-grpc#49 |
Hey @zibul444 The changes I mentioned earlier were merged into the xk6-grpc module, and the Since we want to foster community contributions, I'd like to check if you plan to finalize this PR? If not, we could backport the changes by ourselves since we're close to the moment when we're planning what should the following k6 v0.47 release includes. In any case, thank you for reporting the issue 🙇 |
What?
The GRPC response.message is empty
Why?
The response from the GRPC service, which uses google/protobuf/wrappers, is not processed correctly
Checklist
make ci-like-lint
) and all checks pass.make tests
) and all tests pass.Related PR(s)/Issue(s)
#3232
Yes, this closes the problem
#3232