Commit Graph

540 Commits

Author SHA1 Message Date
Eric Anderson 33a402d924 Avoid NettyServerBuilder when unnecessary
These code locations just needed a generic gRPC server, without any
transport-specific configuration. Use vanilla ManagedServerBuilder
instead of hard-coding to Netty, as we would suggest to our users.
2023-06-05 17:11:16 -07:00
apolcyn b77f0a022f
interop-testing: introduce --additional_metadata flag to let client optionally send extra metadata (#10201)
The flag was documented in https://github.com/grpc/grpc/pull/33180 .
This flag will be useful for some RLS integration tests where we need
to have the client set certain headers for routing purposes.
2023-05-26 06:45:50 -07:00
Eric Anderson 7217baa777 Remove old Java 7/8 TLS testing workarounds
Ciphers have been "fast enough" for testing since early Java 8 updates;
we haven't needed to override ciphers since we dropped Java 7 support.
Java 8u252 had ALPN, so Conscrypt or Jetty ALPN hasn't been necessary
for basic testing for a while. We still want specialized testing for
Conscrypt, but only tests testing Conscrypt need to care.
2023-05-25 14:04:01 -07:00
Eric Anderson 29b8483fd6
Use test fixtures instead of sourceSets.test.output
This avoids the (often missing) evaluationDependsOn and fixes using
results from other projects without propagating those through
Configuration. It also reduces the number of useless classes pulled in
by down-stream tests, reducing the probability of rebuilds.

The expectation of fixtures is they help testing down-stream code that
use the classes in main. That applies to all the classes here except for
FakeClock and StaticTestingClassLoader. It would also apply to many
internal classes in grpc-testing, but let's consider cleaning that up
future work.
2023-05-16 12:10:13 -07:00
Eric Anderson 74b515ecf7 Migrate many usages of TestUtils.loadCert() to the public TlsTesting
TlsTesting.loadCert() is a public API and so should be preferred over
our internal utility. It avoids creating a temp file that has to be
deleted by a shutdown hook. Usages that needed a file were not migrated.
2023-05-09 17:01:31 -07:00
Eric Anderson 847ea7cfc9 Upgrade Mockito to 3.12.4
MockitoAnnotations.initMocks() is deprecated.
2023-05-08 16:39:42 -07:00
Eric Anderson 0bef2b2ef3 interop-testing: Stop using Shadow Gradle Plugin
This essentially reverts 3624d59b. In 6609f11f we removed the reference
to OrcaLoadReport, which meant shadow has no longer been necessary.
2023-05-05 09:00:46 -07:00
apolcyn 708497b6ed
interop-testing: add googleapis and rls as interop client dependencies
The internal build rule for this client already adds these dependencies, and is what related tests for these dependencies have been relying on for a while.

We're starting to use the per-release published interop client docker images for those tests too now, and these use the gradle build rules.
2023-04-24 07:54:32 -07:00
Eric Anderson c35870bce0 interop-testing: Start mgmt server before xds server
The xds server can take a really long time to start if the xds resources
are slow to load. Ideally the management server would be available
during this time so we can inspect the server. The server health still
won't go to SERVING until the xds server starts, which is appropriate.
2023-04-20 11:49:17 -07:00
Terry Wilson a702397903 Revert "testing: RpcBehaviorLoadBalancingProvider to use acceptResolvedAddresses() (#10030)"
This reverts commit 17e1fcb393.
2023-04-14 10:12:33 -07:00
Eric Anderson f6ddd63f09 Increase test timeouts for ARM emulation
LoadWorkerTest.runUnaryBlockingClosedLoop and Http2NettyTest.tlsInfo are
failing every CI run. It appears they are the unfortunate tests run
first, so are slowest to start as classloading proceeds. There's
definitely other tests that probably need adjustment, but fixing these
two gives us some hope of having a green run occasionally.
2023-04-10 21:57:25 -07:00
Terry Wilson 17e1fcb393
testing: RpcBehaviorLoadBalancingProvider to use acceptResolvedAddresses() (#10030) 2023-04-10 12:52:43 -07:00
Daniel Liu 5201e49ce1
services,orca: update backend metrics support to allow for server-wide metrics recording (per-call and OOB) (#9902)
Also added input range validation.
2023-04-10 11:45:04 -07:00
yifeizhuang 687340bbbe
interop-test: fix orca interop test client npe (#9989) 2023-03-24 10:05:56 -07:00
Stanley Cheung 06ec0b93a5
interop-testing: Do not System.exit(0) from interop client
After #9937 was merged, the Java observability tests start to fail.

This System.exit(0) call in the existing Interop client main() method
prevented execution to continue in the new combined Observability
Interop test binary here. (The new binary is calling the old binary's
main() method.)
2023-03-08 11:53:42 -08:00
Eric Anderson 4229191a23 Move gcp-observability interop binary out of interop-testing
gcp-observability has many dependencies so is a bit annoying in some
build systems to get working... just for it not to be used in
non-observability scenarios.

grpc-go and c core are using separate binaries for gcp-observability
interop testing, so do the same in Java, which makes interop-testing a
bit lighter.
2023-03-07 10:57:38 -08:00
Stanley Cheung b55ecd5c35
GCP Observability Interop Testing Client/Server for Java (#9858) 2023-03-06 08:24:42 -08:00
Benjamin Peterson ae6c506f96
all: fix build with errorprone 2.18 (#9886)
errorprone cannot be updated past 2.10 because later versions do not support Java 8.

Fixes https://github.com/grpc/grpc-java/issues/9916.
2023-03-01 13:45:18 -08:00
Larry Safran 19eab29f8d
compiler: Generate interfaces for services to implement (#9688)
Introduce an AsyncService interface in the generated code and move the methods from <service>ImplBase to default implementation of the interface.
* update pom files to allow java 1.8
* Add a bindService(<service>Async) method
* Change TestServiceImpl to use the interface and include a bind method instead of extending TestServiceImplBase.
2023-02-15 10:33:44 -08:00
Larry Safran 5983be1369
rls:Fix throttling in route lookup (b/262779100) (#9874)
* Correct value being passed to throttler which had been backwards.

* Fix flaky test.

* Add a test using AdaptiveThrottler with a CachingRlsLBClient.

* Address test flakiness.
2023-02-06 15:19:16 -08:00
Colin Alworth 706646f8bb
servlet: Implement gRPC server as a Servlet (#8596)
Full end to end implementation of gRPC server as a Servlet including tests and examples

Co-authored-by: Penn (Dapeng) Zhang <zdapeng@google.com>
Co-authored-by: Chengyuan Zhang <chengyuanzhang@google.com>
2023-01-20 13:17:58 -08:00
Alexander Polcyn ecc7cf35a2 Address internal linter suggestions 2023-01-18 13:33:19 -08:00
apolcyn 23d34cdd84
testing: create test client for XDS federation integration tests (#9798)
This client can be used as a part of XDS federation integration tests. It can concurrently perform RPCs with different stubs using different underlying XDS servers.

For example, one might perform proxyless service mesh and DirectPath RPCs in the same process with flags like:

```
--server_uris=xds:///${PSM_TARGET},google-c2p:///${DIRECTPATH_TARGET} \
--credentials_types=INSECURE_CREDENTIALS,compute_engine_channel_creds \
--test_case=rpc_soak \
--soak_iterations=10  \
--soak_max_failures=0  \
--soak_per_iteration_max_acceptable_latency_ms=2500 \
--soak_overall_timeout_seconds=300
```
2023-01-13 11:55:08 -08:00
yifeizhuang 45554def76
interop test: fix project evaluation order (#9800) 2023-01-09 15:49:07 -08:00
Chris Povirk c0de130ac6 Change ArgumentCaptor.forClass(null) to ArgumentCaptor.forClass(Foo.class)
The former will [soon throw NullPointerException][notnull].

[notnull]: fe1cb2de09 (diff-8d274a9bda2d871524d15bbfcd6272bd893a47e6b1a0b460d82a8845615f26daR31)
2023-01-09 07:15:23 -08:00
Eric Anderson d17a2db4bd Upgrade to Checkstyle 8.28
Trying to upgrade Gradle to 7.6 improved the checkstyle plugin such that
it appears to have been running in new occasions. That in turn exposed
us to https://github.com/checkstyle/checkstyle/issues/5088. That bug was
fixed in 8.28, which also fixed lots of other bugs. So now we have
better checking and some existing volations needed fixing. Since the
code style fixes generated a lot of noise, this is a pre-fix to reduce
the size of a Gradle upgrade.

I did not upgrade past 8.28 because at some point some other bugs were
introduced, in particular with the Indentation module. I chose the
oldest version that had the particular bug impacting me fixed. Upgrading
to this old-but-newer version still makes it easier to upgrade to a
newer version in the future.
2023-01-05 17:07:04 -08:00
Larry Safran c145473756
Improve error message when deadline is exceeded, making it clear which deadline (Context or CallOptions) was exceeded and making the grammar clearer. (#9713) 2022-11-30 13:58:57 -08:00
yifeizhuang b593871801
core: fix RejectedExecutionException in Retriable Stream (#9626)
Add big negative integer to pending stream count when cancelled. The count is used to delay closing master listener until streams fully drained.
Increment pending stream count before creating one. The count is also used to indicate callExecutor is safe to be used. New stream will not be created if big negative number was added, i.e. stream cancelled. New stream is created if not cancelled, callExecutor is safe to be used, because cancel will be delayed.
Create new streams (retry, hedging) is moved to the main thread, before callExecutor calls drain.
Minor refactor the masterListener.close() scenario.
2022-11-22 13:04:06 -08:00
Eric Anderson bacf18db8d
census: Avoid deprecated measure constants
Many of the deprecated constants are just aliases for non-deprecated
constants, so just swap which one we use.
2022-09-12 08:19:21 -07:00
Larry Safran b66250e9e5
Rls spec sync (#9437)
rls: Update implementation to match spec.

* Cleanup cache if exceeds max size when add an entry. Make cache entry size calculations more accurate
* Trigger pending RPC processing if unexpired backoff entries were removed from the cache by triggering helper to call it's parent updateBalancingState with the same state and picker
* Introduce minimum time before eviction (5 seconds)
* Change default accept ratio for AdaptiveThrottler from 1.2 -> 2.0
* Configuration validation
* When checking key names for duplicates also look at headers
* Check extra keys for duplicates

See analysis of implementation versus spec at https://docs.google.com/spreadsheets/d/18w5s1TEebRumWzk1pvWnjiHFGKc6MW-vt8tRLY4eNs0/
2022-08-19 13:31:05 -07:00
Eric Anderson 61f19d707a
Swap Animalsniffer to Java 8 and Android 19
Also added missing signatures. Swapping to version catalog will make
this process easier in the future.
2022-08-10 12:41:57 -07:00
Terry Wilson 7665d3850b
Revert "Add LoadBalancer.acceptResolvedAddresses() (#8742)" (#9414)
This reverts commit 70a29fbfe3.
2022-07-28 12:15:26 -07:00
Terry Wilson 70a29fbfe3
Add LoadBalancer.acceptResolvedAddresses() (#8742)
Introduces a new acceptResolvedAddresses() to the LoadBalancer.

This will now be the preferred way to handle addresses from the NameResolver. The existing handleResolvedAddresses() will eventually be deprecated.

The new method returns a boolean based on the LoadBalancers ability to use the provided addresses. If it does not accept them, false is returned. LoadBalancer implementations using the new method should no longer implement the canHandleEmptyAddressListFromNameResolution(), which will eventually be removed, along with handleResolvedAddresses().

Backward compatibility will be maintained so existing load balancers using handleResolvedAddresses() will continue to work.

Additionally the previously deprecated handleResolvedAddressGroups() method is removed.
2022-07-26 09:23:37 -07:00
yifeizhuang 5f1a1d4f35
service: CalMetricRecorder.recordCallMetric is deprecated, use CalMetricRecorder.recordRequestCostMetric (#9410) 2022-07-25 13:10:29 -07:00
Eric Anderson 0e45e04041
Avoid accidental locale-sensitive String.format()
%s is fairly safe (requires a Formattable to use Locale), so %d is the
main risk item. Places that really didn't need to use String.format()
were converted to plain string concatenation. Logging locations were
generally converted to using the log infrastructure's delayed
formatting, which is generally locale-sensitive but we're okay with
that. That wasn't done in okhttp, however, because Android frequently
doesn't use MessageFormat so we'd lose the parameters. Everywhere else
was explicitly defined to be Locale.US, to be consistent independent of
the default system locale.
2022-07-19 14:41:34 -07:00
yifeizhuang 756fdf3f2c
service: make the orca MetricReport a top level experimental class (#9382) 2022-07-18 13:23:55 -07:00
apolcyn 267d15412f
interop client: fix soak test bug where we can crash if peer wasn't set 2022-07-15 15:54:54 -07:00
yifeizhuang 6609f11f48
xds: do not expose orca proto in ORCA api (#9366)
The fix avoids shaded dependency of orca protos
2022-07-15 09:41:50 -07:00
Eric Anderson 9cd17ce3a7 Fix Gradle UP-TO-DATE checking for all tasks
The two checker tasks run quickly so don't gain much from UP-TO-DATE,
but it is convenient to not see them in the noise (checkUpperBoundDeps
in particular). Gradle only performs UP-TO-DATE checks (on the inputs)
if the task has both inputs and outputs defined.

The biggest saving was for distZip/distTar/shadowDistZip/shadowDistTar
which were using the same name for the non-shadow and shadow versions.
Thus the output file would always be out-of-date because it had been
rewritten and was invalid. This is worrisome because we could have
"randomly" been using the shadow Zip/Tar at times and the non-shadow
ones at others, although I think in practice the shadow tasks always run
last and so those are the files we'd see. Changing the classifier avoids
the colliding file names. These tasks took ~7 seconds, so incremental
builds are considerably shorter now.
2022-07-11 11:06:10 -07:00
Eric Anderson 57fe766d10 interop-testing: Hack runtimeOnly deps to be available at runtime
RuntimeOnly dependencies have been missing since 3624d59. This is
because the implementation configuration extendsFrom the shadow
configuration, so any of the things like runtimeOnly are being lost.
This change isn't "correct" but it stops the bleeding with minimal cost.
It is probably incorrect to be using shadow plugin in interop-testing at
all.
2022-07-11 10:31:40 -07:00
Eric Anderson 19ad4467db Service config parse failures should be UNAVAILABLE
INVALID_ARGUMENT is propagated to the data plane if no previous config
is available. INVALID_ARGUMENT is reserved for application use; LBs
should pretty much use UNAVAILABLE exclusively.

While most of the changes are in xds, there do not appear to be likely
xds code paths that would propagate a bad status to the data plane.
Internal policies either don't use parseLoadBalancingPolicyConfig() and
instead have their configuration objects constructed directly or are
constructed transitively through the cluster manager which uses INTERNAL
if there's a child failure. There was a worrisome hole before this
commit for StatusRuntimeExceptions received by the cluster manager, but
the audit didn't find any locations throwing such an exception.
User-selected policies produce a NACK and are protected from the
existing xds client watcher paths. The worst that appears could happen
is the channel could panic (which uses INTERNAL) if a bug let a bad
configuration through.
2022-07-08 15:49:12 -07:00
Eric Anderson 0ff9f37b9e Use Gradle's task configuration avoidance APIs
This can avoid creating an additional 736 tasks (previously 502 out of
1591 were not created). That's not all that important as the build time
is essentially the same, but this lets us see the poor behavior of the
protobuf plugin in our own project and increase our understanding of how
to avoid task creation when developing the plugin. Of the tasks still
being created, protobuf is the highest contributor with 165 tasks,
followed by maven-publish with 76 and appengine with 53. The remaining
59 are from our own build, but indirectly caused by maven-publish.
2022-07-08 12:16:40 -07:00
Eric Anderson 2fc7ac441c interop-testing: Add cartesian product HTTP/2 interop test 2022-07-01 12:38:01 -07:00
sanjaypujare 957d4e8b6f
Revert "interop-testing: add echo-server for proxyless gRPC testing in Istio (#9261)" (#9318)
This reverts commit c2d33f15be.
2022-06-27 17:30:47 -07:00
apolcyn 641746622e
interop-testing: add --soak_min_time_ms_between_rpcs flag and log peer addresses (#9282) 2022-06-27 16:31:25 -07:00
sanjaypujare c2d33f15be
interop-testing: add echo-server for proxyless gRPC testing in Istio (#9261) 2022-06-24 15:20:14 -07:00
Terry Wilson 7bd0797496
all: Update netty to 4.1.77.Final and netty_tcnative to 2.0.53.Final (#9027)
all: Update netty to 4.1.77.Final and netty_tcnative to 2.0.53.Final

Also switches to a non-release version of rules_jvm_external to allow Bazel build to work with artifact classifiers.
2022-06-24 10:47:27 -07:00
amirhadadi 7b80954fd5 core,interop-testing: avoid flushing after writing a message in case the server returns a single response 2022-06-24 07:13:25 -07:00
yifeizhuang f0c934e4c1
interop-test: fix import, no cast to ServerStreamCallObserver (#9299) 2022-06-21 12:41:33 -07:00
yifeizhuang 630d63b7cc
interop-testing: add orca_oob lock to allow only one test client at a time to perform the test case (#9260) 2022-06-17 10:41:30 -07:00