PHP & Ruby xds interop tests: add support for xds splitting and routing#23763
PHP & Ruby xds interop tests: add support for xds splitting and routing#23763stanley-cheung merged 2 commits intogrpc:masterfrom
Conversation
|
Tests are not passing if run from kokoro for some reason. Looking into it. Things are fine when I run this locally. I was able to pass |
| --test_case=all \ | ||
| --test_case=ping_pong \ | ||
| --project_id=grpc-testing \ | ||
| --source_image=projects/grpc-testing/global/images/xds-test-server \ |
There was a problem hiding this comment.
Update this to projects/grpc-testing/global/images/xds-test-server-2 (Append -2)
grpc/grpc-go#3764 (files)
There was a problem hiding this comment.
Done. Thanks for the pointer. Yea I also noticed the discrepancy.
00167fc to
d984bbe
Compare
|
Now all PHP xds test cases are passing. Adhoc run: https://g3c.corp.google.com/results/invocations/7f2b5361-2808-4c17-a1d0-2e5fa87ad43c/targets. And Ruby is passing too: https://g3c.corp.google.com/results/invocations/0f46ed89-b354-4957-b9ce-1e90f6f66e88/targets. |
89a6900 to
62eaa25
Compare
menghanl
left a comment
There was a problem hiding this comment.
Thanks for the change and the test results. LGTM!
|
@stanley-cheung This PR is approved, but it still a draft. Are you planning to merge it soon? Thanks! |
|
There's still some issues with the Ruby generated code in this PR - I'd like to have #23672 resolved first. We are getting close there. |
|
The PR #23765 is going to fix a bug in the Ruby protoc plugin. In the process, we are going to re-generate some generated files, which will contain some changes to the .proto files here (e.g. the new That PR is almost done. Will update this PR, to take advantage of those updated .rb files, after that PR is merged. |
1a1a77e to
5bdab78
Compare
|
Somehow I am having trouble with Ruby + One adhoc run that failed: https://g3c.corp.google.com/results/invocations/283bb414-5ea4-489b-88bc-dc3829d7f933/targets;showStatuses=failed,passed |
76fe9c1 to
7fc5b52
Compare
|
@apolcyn Can you please review the Ruby part PHP Adhoc run passing: https://g3c.corp.google.com/results/invocations/6cb7ed07-e304-47d8-b55d-4957b0027ea1/targets |
| end | ||
| # convert results into proper proto object | ||
| rpcs_by_method = {} | ||
| watcher['rpcs_by_method'].each do | rpc_name, rpcs_by_peer | |
There was a problem hiding this comment.
small nit: we don't have spaces before or after opening and closing | parameter brackets in do blocks elsewhere in the code, lets remove for consistency
| remote_peer = "" | ||
| begin | ||
| op.execute | ||
| if op.metadata.key?('hostname') |
There was a problem hiding this comment.
Where is the hostname metadata key getting populated?
There was a problem hiding this comment.
This is the updated spec for this xDS interop test - that the remote hostname will be returned as part of the call's initial metadata, instead of in the RPC's response proto.
In the past, the remote hostname is being returned as a field in the SimpleResponse proto https://github.com/grpc/grpc/blob/v1.31.x/src/ruby/pb/test/xds_client.rb#L127, https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/messages.proto#L120. But since now, after the updated spec, we could be sending EmptyCall RPC, we can't be expecting this field to be in the response proto uniformly. So the updated spec specified that this key will be populated as part of the initial metadata.
Also, an RPC may be designed to not be successful as part of the test, so we need to check whether that key exists in the initial metadata as well.
There was a problem hiding this comment.
Got it, thanks.
Also, an RPC may be designed to not be successful as part of the test, so we need to check whether that key exists in the initial metadata as well.
Slightly confused about this part, though. Looks like we currently don't check the peer via metadata at all if the call fails.
There was a problem hiding this comment.
The spec mentioned that All clients read hostname from header[“hostname”] instead of from RPC response. It seems that it's unclear whether the initial metadata should be read if the RPC failed. I will follow up with Menghan and Eric to see what the behavior should be. As it stands, it passes all the test cases so perhaps it doesn't matter for now. I am inclined to merge this PR as is. If there's an issue with this particular piece of logic we can always fix it later.
There was a problem hiding this comment.
Right, whether to read "hostname" from metadata when the RPC fails is currently not defined. Mostly because none of the existing tests depends on hostname when the RPC fails. It's OK for the client to ignore it.
This may change in the future, to test failure cases (fault injection for example). But it not super clear how the behavior will be, so let's worry about it later.
|
|
||
| # execute 1 RPC and return remote hostname | ||
| def execute_rpc(op, fail_on_failed_rpcs) | ||
| remote_peer = "" |
There was a problem hiding this comment.
Question about the spec -- are the keys in rpcs_by_peer supposed to be hostnames, or socket addresses?
If socket addresses, we can use the peer getter on ops.
There was a problem hiding this comment.
Similar response to above - according to the new updated test spec, we need to expect this hostname key in the call's initial metadata.
| watcher['no_remote_peer'] += 1 | ||
| else | ||
| watcher['rpcs_by_peer'][remote_peer] += 1 | ||
| results.each do | rpc_name, remote_peer | |
There was a problem hiding this comment.
same nit here for spaces around do/end block parameter brackets
7fc5b52 to
7c794b9
Compare
apolcyn
left a comment
There was a problem hiding this comment.
LGTM for ruby, with just a couple of questions
| remote_peer = "" | ||
| begin | ||
| op.execute | ||
| if op.metadata.key?('hostname') |
There was a problem hiding this comment.
Got it, thanks.
Also, an RPC may be designed to not be successful as part of the test, so we need to check whether that key exists in the initial metadata as well.
Slightly confused about this part, though. Looks like we currently don't check the peer via metadata at all if the call fails.
| end | ||
| $watchers_mutex.synchronize do | ||
| $watchers.each do |watcher| | ||
| # this is counted once when each group of all rpcs_to_send were done |
There was a problem hiding this comment.
is there a place in the spec that says this? If so can we link this comment to there?
There was a problem hiding this comment.
The "change" to the spec, which this PR addressed, hasn't been merged to the main xDS test description doc yet. It's just in an internal doc linked from the internal bug b/161801377.
In there, it specified that the new --rpc param will specify the list of RPCs to make (i.e. UnaryCall, EmptyCall, etc). And --qps=10 means to make 10 RPCs/second for each type.
|
Both PHP and Ruby have a green run on |
Internal bug: PHP b/161801379, Ruby b/161801377.
Add support in xDS interop tests for traffic splitting and route matching, for PHP and Ruby, in particular, the new
path_matchingandheader_matchingtest cases. For the spec doc, please check the internal bug linked at the top.Current status:
src/php/tests/interop/xds_client.phpandsrc/ruby/pb/test/xds_client.rb.--rpc=and--metadata=.UnaryCallRPC, now we can be sending a list of RPCs specified by--rpc=.rpcs_by_methodresult histogram, in addition to therpcs_by_peersalready being returned.The generated code might need some more clean up. Please ignore them for now. For Ruby generated code, we might need to get [ruby] module path names seems to be broken in >= v1.30.2 #23672 resolved first.There will be no generated code change for Ruby. All already done in Ruby: use absolute module name for request/response namespaces #23765 .Doing a run ofAdhoc xds test each for PHP and Ruby all passed.