Commit Graph

453 Commits

Author SHA1 Message Date
Eric Anderson 20ac1999d4
stub: Mark Stub-based MetadataUtils methods deprecated
We don't want other APIs to copy the stub-based API to attach the
interceptor. The API has a shorter name, but isn't actually all that
easier to use and isn't fluent like using the interceptor API.

These are _very_ old methods, so we won't be quick to delete them. Seems
we should have them deprecated at least a year or two; they are easy to
maintain in the mean time.

See API Review notes in #1789
2021-08-06 14:14:17 -07:00
ZHANG Dapeng 860e97d12a
all: API refactoring in preparation to support retry stats (#8355)
Rebased PR #8343 into the first commit of this PR, then (the 2nd commit) reverted the part for metric recording of retry attempts. The PR as a whole is mechanical refactoring. No behavior change (except that some of the old code path when tracer is created is moved into the new method `streamCreated()`).

The API change is documented in go/grpc-stats-api-change-for-retry-java
2021-07-31 18:33:02 -07:00
ZHANG Dapeng d836f38979
core: add real transport test for retry buffer limit (#8354)
The unit tests in RetriableStreamTest do not really test buffer limit from end to end, because the buffer limit is implemented using ClientStreamTracer.Factory, and the tracer callback outboundMessageSize() is only triggered in AbstractClientStream after message serialization. In fact, it was broken without failing any existing tests (#8343 (comment))

This PR adds a retry buffer limit test that runs through the AbstractClientStream code path.
2021-07-28 18:59:50 -07:00
ZHANG Dapeng 438f8d9e78
interop-testing: extend XdsTestServer features to support retry test
Extend XdsTestServer features as specified in go/xds-retry-interop-test

See also xds retry interop test case implementation grpc/grpc#26746, grpc/grpc#26791

Previously, rpc-behavior values in the request headers are handled in tow different places, one in interceptor and the other in service implementation via Context. I moved all the rpc-behavior handling in interceptor, Context is not needed any more.
2021-07-26 12:04:58 -07:00
Eric Anderson 0cabf5672a compiler: Add GrpcGenerated annotation to generated class
This can be used by annotation processors to avoid processing the
gRPC-generated code. The normal Generated annotation only has SOURCE
retention, so isn't available to annotation processors.

I don't include the service name within the annotation as that assumes
we'll never have need for any other type of generated class. If there's
a request for exposing service name via an annotation in the future, we
can make an RpcService annotation or the like.

Fixes #8158
2021-07-02 22:11:40 -07:00
Eric Anderson 6201db2d96 Fix aarch64 emulation-triggered flakes
Because we are emulating aarch64 during testing the tests run slower
than normal. Bumping the timeout seems easy and obvious for
StressTestClientTest. The warmup for BinlogHelperTest mirrors what we've
done with timing-based tests in the past. Hopefully that is enough to
lower variance so that it passes consistently; seems likely. I'd rather
not increase the timing fuzziness if I can avoid it, as that reduces the
test's ability to detect issues.

Fixes #8135 (mostly+hopefully)
2021-06-17 13:32:11 -07:00
Eric Anderson 5642e01243
Replace failOnVersionConflict() with custom requireUpperBoundDeps
failOnVersionConflict has never been good for us. It is equivalent to
Maven dependencyConvergence which we discourage our users to use because
it is too tempermental and _creates_ version skew issues over time.
However, we had no real alternative for determining if our deps would be
misinterpeted by Maven.

failOnVersionConflict has been a constant drain and makes it really hard
to do seemingly-trivial upgrades. As evidenced by protobuf/build.gradle
in this change, it also caused _us_ to introduce a version downgrade.

This introduces our own custom requireUpperBoundDeps implementation so
that we can get back to simple dependency upgrades _and_ increase our
confidence in a consistent dependency tree.
2021-06-11 14:01:18 -07:00
Chengyuan Zhang bab1fe38dc
services: move classes with protobuf dependency into io.grpc.protobuf.services (#8056)
To separately manage services/classes with and without protobuf dependency in services package, we are moving classes with protobuf dependency into io.grpc.protobuf.services. This includes healthchecking, reflection, channelz, and binlogging.

Forwarding classes are created to avoid breaking existing users, while they are marked as deprecated to notify users to migrate.
2021-04-16 17:27:12 -07:00
Sergii Tkachenko 11c3667b8c interop-testing: xDS interop app uses AdminInterface 2021-03-30 21:23:19 -04:00
apolcyn ab216a1720
interop-testing, xds: Allow using TestServiceClient for making Traffic Director RPCs (#7994)
Updates TestServiceClient to support creating channel without target port (mostly useful for xDS that uses the channel target as the resource name).

Adds an env var for overriding the TD URI used in cloud-to-prod test.
2021-03-19 12:44:52 -07:00
Eric Anderson c26ee03cd9 netty: Add Http2Headers.setLong() for inbound headers
Starting in Netty 4.1.60, Netty will validate Content-Length headers
using getAll() and setLong(). While getAll() was documented as only used
in tests, it doesn't appear it was currently used in any tests.

While Http2NettyTest.contentLengthPermitted() was added to confirm that
Content-Length works, it won't actually exercise any interesting
behavior until we upgrade to Netty 4.1.60. However, I did test with
Netty 4.1.60 and it reproduced the failure in
https://github.com/grpc/grpc-java/issues/7953 and passed with this
change.

Since Netty is now observing/modifying the headers, it would seem
appropriate to implement a substantial portion of the Http2Headers API.
However, the surface is much larger than we'd want to implement for a
'quick fix' that could be backported. In addition, it seems much of the
API is just convenience methods, so it is probably appropriate to split
out a AbstractHeaders class from DefaultHeaders in Netty that doesn't
make any assumptions about the header storage mechanism.
2021-03-16 16:36:18 -07:00
apolcyn 972fda2cd7
Add a flag to interop clients to allow statically configuring grpclb (#7957) 2021-03-11 10:55:18 -08:00
Eric Anderson a55e034732 interop-testing: Specify ca-cert with transport-agnostic Credentials API 2021-02-19 09:30:24 -08:00
Eric Anderson 2e0e238fb2 okhttp: Consume mTLS and Trust/KeyManager Credentials API 2021-02-19 09:30:24 -08:00
Eric Anderson 0eab1c9176 netty: Consume mTLS and Trust/KeyManager Credentials API 2021-02-19 09:30:24 -08:00
yifeizhuang 0d2ea9365a
interop-testing: fix alts handshaking race (#7896) 2021-02-12 09:50:49 -08:00
yifeizhuang 7f7821c616
interop-testing: add fake altsHandshakerService for test (#7847) 2021-02-09 16:56:26 -08:00
Chengyuan Zhang 14a38ef9b5
interop-testing: implement test client support for xDS timeout test (#7837)
Changes the xDS interop test client to support timeout test.

- Synced xDS test proto messages with grpc-proto.
- Changed RpcConfig to be the configuration for per test method type. Added timeoutSec for its deadline configuration.
- Changed accumulated stats to include RPC status instead of just succeeded/failed.
2021-01-27 17:09:01 -08:00
Doug Fawley ec270a7757
interop-testing: support rpc sleep behavior for xDS test server (#7836) 2021-01-25 10:14:37 -08:00
Yifei Zhuang ff59104b62
Revert "interop-testing: allow multiple port in test server (#7799)" (#7805)
This reverts commit dac8347063.

Changing from Grpc. newServerBuilder to NettyServerBuilder breaks interop-test with credentials.
2021-01-13 15:08:42 -08:00
Yifei Zhuang dac8347063
interop-testing: allow multiple port in test server (#7799) 2021-01-13 09:47:26 -08:00
ZHANG Dapeng 7d77f64773
compiler: remove some of the static imports in codegen (#7751)
Resolves #7741 
Some of the static methods in generated code have the same method name but different package name, such `ClientCalls.asyncClientStreamingCall` and `ServerCalls.asyncClientStreamingCall`. It's less readable using static import than using full-qualified method name in-place.
2020-12-23 11:28:03 -08:00
Sergii Tkachenko e5f57adb7f
buildscripts: xDS Kubernetes Interop tests buildscript 2020-12-23 09:52:01 -05:00
Chengyuan Zhang 0fb2667c96
all: Fix opencensus-api dependency conflict (#7739)
We depend on 0.28.0 while oauth2 depends on 0.24.0. This change replaces oauth2's opencensus-api dependency with our own.
2020-12-21 12:02:17 -08:00
Sergii Tkachenko d9becc74d8
interop: add channelz to xds interop test server running in non-secure mode 2020-12-09 11:06:52 -05:00
sanjaypujare 71606479ed
interop: add channelz and reflection support to xds interop test client and server (#7701)
* interop: add channelz support to xds interop test client and server

* add reflection

Co-authored-by: Sergii Tkachenko <sergiitk@google.com>
2020-12-07 10:48:36 -08:00
Sergii Tkachenko 9211bd1914 interop-testing: rename XdsTestClient secure_mode argument 2020-11-24 20:39:53 -05:00
sanjaypujare a7530efd6e
interop: create PSM security xDS interop tests - server & client (#7609)
Co-authored-by: Sergii Tkachenko <hi@sergii.org>
2020-11-20 18:31:40 -08:00
Eric Anderson ddd5dea7e9 Migrate callers to ServerCredentials 2020-11-13 11:13:33 -08:00
Chengyuan Zhang 76ad953c36
interop-testing: fix wrong semantics for RPC failure stats in xDS test client (#7618)
The proto field is named as num_failures but its comment is saying it is for number of RPCs that failed to record a remote peer. RPC failed == RPC failed to record a remote peer was true previously (so no existing tests should be affected by this changed) as server completed RPCs immediately. It is no longer true with server capability to keep the call open/delayed.

This change clarifies the proto definition for stats RPC. rpcs_by_peer is for recording RPCs succeeded and num_failures is for RPCs failed. RPCs in the flight when the stats call times out are not counted towards any of the stats.
2020-11-13 10:28:44 -08:00
Chengyuan Zhang bf191cb5ea
interop-testing: aggregate accumulated stats by RPC methods in xDS test client (#7603)
Update xDS interop test proto to aggregate accumulated stats based on RPC methods (mirroring 643e5bcd1e8db931cf76a3be19cd9bba223ee987 in C-core's change). Updated the xDS interop test client to support querying accumulated stats aggregated to RPC methods.
2020-11-10 23:58:09 -08:00
Chengyuan Zhang 01e3832b42
interop-testing: fix bug of not completing client configure RPC in xDS test client (#7597) 2020-11-05 16:16:52 -08:00
Chengyuan Zhang 8e04df99f3
interop-testing: support dynamic configuration and accumulated stats for xDS test client (#7549) 2020-11-03 10:33:41 -08:00
Chengyuan Zhang b2bf5fa7f5
interop-testing: support rpc keep-open for xDS test server (#7548) 2020-11-03 10:33:17 -08:00
Chengyuan Zhang 90a3873a13
interop-testing: only need to count total number of succeeded RPCs for accumulated stats in xDS tests (#7561) 2020-10-27 16:09:16 -07:00
Chengyuan Zhang f5c7f4e154
interop-testing: add proto definitions for xDS circuit breaking test (#7545) 2020-10-21 17:57:34 -07:00
Eric Anderson 38fe5d276f interop-testing: Remove redundant tearDown() in hook
The main() Thread will call tearDown() itself. It appears this
redundancy has existed since e813eaae2f, where the normal error handling
was enhanced at the same time as cleaning up resource management. The
cleanup should have made it obvious the hook was no longer needed, but
alas. Technically, it did originally provide a purpose if setup()
failed, but it would have been better to just move setup() into the
try-catch instead. Today it doesn't even provide that purpose.
2020-10-13 16:34:57 -05:00
Eric Anderson 0203256171 interop-testing: Avoid alts incompatibility with netty
alts requires netty-shaded, not netty.
2020-10-08 12:59:26 -05:00
Eric Anderson a547e23f5e Migrate users of ManagedChannelBuilder.{forTarget,forAddress} to ChannelCredentials 2020-10-07 13:58:37 -05:00
Sergii Tkachenko b03f148ed9 core, netty: server builders extend a public API class 2020-09-03 16:26:04 -04:00
Sergii Tkachenko c29ad76dae Explain test value for flow control window 2020-09-02 14:51:39 -04:00
Sergii Tkachenko 5d1304c33c okhttp: OkHttpChannelBuilder extends a public API class 2020-09-02 13:28:52 -04:00
Sergii Tkachenko c056979671 netty: NettyChannelBuilder extends a public API class 2020-09-02 13:28:52 -04:00
Sergii Tkachenko b0f0ed080e core: InProcessChannelBuilder extends a public API class 2020-09-02 13:28:52 -04:00
Eric Anderson 0773c1aa05 interop-testing: Remove comparison of proto field to null
Proto fields aren't null. The getter will return an empty string instead
of null.

cl/326415191
2020-08-13 10:01:07 -07:00
Eric Anderson e92b2275f9 Update to Error Prone 2.4
Most of the changes should be semi-clear why they were made. However, BadImport
may not be as obvious: https://errorprone.info/bugpattern/BadImport . That
impacted classes named Type, Entry, and Factory. Also
PublicContructorForAbstractClass:
https://errorprone.info/bugpattern/PublicConstructorForAbstractClass

The JdkObsolete issue is already resolved but is not yet in a release.
2020-08-06 10:56:16 -05:00
Eric Anderson 026673cff5 gradle: Fix Gradle 6 warnings
Most of these are easy "replace X with Y."

The CreateStartScripts changes were because the scripts were being included in
the output zip/tar multiple times. The was because they were all using the same
output directory, and the entire output directory was being included for each.
The output directory tmp/ was particularly poor because other tasks were
dumping things into it, so our zip/tar was including those junk files as well.
2020-07-31 09:52:36 -05:00
Eric Gribkoff 4fbe6bef7d
interop-testing: add flags to xds test client 2020-07-28 12:43:00 -07:00
Trustin Lee 1d443e0389
interop-testing: fix flakiness of deadlineExceeded test (#7202)
Increase the deadline amount to avoid the false positive of deadline exceeded due to the call is scheduled to start after the deadline.
2020-07-17 10:40:15 -07:00
Eric Anderson 3a43abef7b
interop-testing: Use normal runtimeOnly dep for xds (#7200)
This prevents grpc-xds and its transitive dependencies from being included
twice in distTar and distZip, which reduces the size from 60 MB to 40 MB. It
does mean that interop-testing as a whole depends on xds, but that should not
be an issue any longer. It was an issue before we started providing grpc-xds on
Maven Central.
2020-07-14 13:25:40 -07:00