mirror of https://github.com/grpc/grpc-java.git
interop-testing: allow disabling of stream tracers (#10609)
This adds the ability to disable the installation of stream tracers in each test call in AbstractInteropTest. The tracers are stored in a list and used to make assertions by normal tests, but a long running stress test will accumulate too many entries in this list and the heap gets wuickly filled up.
This commit is contained in:
parent
0d39bf5018
commit
ccf9101828
|
|
@ -313,6 +313,11 @@ public abstract class AbstractInteropTest {
|
||||||
|
|
||||||
private final LinkedBlockingQueue<TestClientStreamTracer> clientStreamTracers =
|
private final LinkedBlockingQueue<TestClientStreamTracer> clientStreamTracers =
|
||||||
new LinkedBlockingQueue<>();
|
new LinkedBlockingQueue<>();
|
||||||
|
private boolean enableClientStreamTracers = true;
|
||||||
|
|
||||||
|
void setEnableClientStreamTracers(boolean enableClientStreamTracers) {
|
||||||
|
this.enableClientStreamTracers = enableClientStreamTracers;
|
||||||
|
}
|
||||||
|
|
||||||
private final ClientStreamTracer.Factory clientStreamTracerFactory =
|
private final ClientStreamTracer.Factory clientStreamTracerFactory =
|
||||||
new ClientStreamTracer.Factory() {
|
new ClientStreamTracer.Factory() {
|
||||||
|
|
@ -343,9 +348,14 @@ public abstract class AbstractInteropTest {
|
||||||
startServer(serverBuilder);
|
startServer(serverBuilder);
|
||||||
channel = createChannel();
|
channel = createChannel();
|
||||||
|
|
||||||
|
if (enableClientStreamTracers) {
|
||||||
blockingStub =
|
blockingStub =
|
||||||
TestServiceGrpc.newBlockingStub(channel).withInterceptors(tracerSetupInterceptor);
|
TestServiceGrpc.newBlockingStub(channel).withInterceptors(tracerSetupInterceptor);
|
||||||
asyncStub = TestServiceGrpc.newStub(channel).withInterceptors(tracerSetupInterceptor);
|
asyncStub = TestServiceGrpc.newStub(channel).withInterceptors(tracerSetupInterceptor);
|
||||||
|
} else {
|
||||||
|
blockingStub = TestServiceGrpc.newBlockingStub(channel);
|
||||||
|
asyncStub = TestServiceGrpc.newStub(channel);
|
||||||
|
}
|
||||||
|
|
||||||
ClientInterceptor[] additionalInterceptors = getAdditionalInterceptors();
|
ClientInterceptor[] additionalInterceptors = getAdditionalInterceptors();
|
||||||
if (additionalInterceptors != null) {
|
if (additionalInterceptors != null) {
|
||||||
|
|
|
||||||
|
|
@ -466,6 +466,10 @@ public class StressTestClient {
|
||||||
|
|
||||||
Tester tester = new Tester();
|
Tester tester = new Tester();
|
||||||
tester.setUp();
|
tester.setUp();
|
||||||
|
// The client stream tracers that AbstractInteropTest installs by default would fill up the
|
||||||
|
// heap in no time in a long running stress test with many requests.
|
||||||
|
tester.setEnableClientStreamTracers(false);
|
||||||
|
|
||||||
WeightedTestCaseSelector testCaseSelector = new WeightedTestCaseSelector(testCaseWeightPairs);
|
WeightedTestCaseSelector testCaseSelector = new WeightedTestCaseSelector(testCaseWeightPairs);
|
||||||
Long endTime = durationSec == null ? null : System.nanoTime() + SECONDS.toNanos(durationSecs);
|
Long endTime = durationSec == null ? null : System.nanoTime() + SECONDS.toNanos(durationSecs);
|
||||||
long lastMetricsCollectionTime = initLastMetricsCollectionTime();
|
long lastMetricsCollectionTime = initLastMetricsCollectionTime();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue