aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerry Wilson <tmwilson@google.com>2023-10-25 14:19:32 -0700
committerGitHub <noreply@github.com>2023-10-25 14:19:32 -0700
commit18a5f8a90bb9b79daaceb6871c55efdc306a3ead (patch)
treeef123a80c0a2a283533e53fba3242ebdc1706f17
parent86835ae8171ed21b1deb8daa55bd481e361076f0 (diff)
downloadgrpc-grpc-java-18a5f8a90bb9b79daaceb6871c55efdc306a3ead.tar.gz
interop-testing: Stress test log for total calls (#10626)
Allows stress tests to make assertions based on the total amount of calls made by the stress test client.
-rw-r--r--interop-testing/src/main/java/io/grpc/testing/integration/StressTestClient.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/interop-testing/src/main/java/io/grpc/testing/integration/StressTestClient.java b/interop-testing/src/main/java/io/grpc/testing/integration/StressTestClient.java
index 8f2c73491..f09ee5aa5 100644
--- a/interop-testing/src/main/java/io/grpc/testing/integration/StressTestClient.java
+++ b/interop-testing/src/main/java/io/grpc/testing/integration/StressTestClient.java
@@ -59,6 +59,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -91,6 +92,7 @@ public class StressTestClient {
client.runStressTest();
client.startMetricsLogging();
client.blockUntilStressTestComplete();
+ log.log(Level.INFO, "Total calls made: {0}", client.getTotalCallCount());
} catch (Exception e) {
log.log(Level.WARNING, "The stress test client encountered an error!", e);
} finally {
@@ -117,6 +119,7 @@ public class StressTestClient {
private Server metricsServer;
private final Map<String, Metrics.GaugeResponse> gauges =
new ConcurrentHashMap<>();
+ private final AtomicLong totalCallCount = new AtomicLong(0);
private volatile boolean shutdown;
@@ -410,6 +413,10 @@ public class StressTestClient {
return builder.build();
}
+ private long getTotalCallCount() {
+ return totalCallCount.get();
+ }
+
private static String serverAddressesToString(List<InetSocketAddress> addresses) {
List<String> tmp = new ArrayList<>();
for (InetSocketAddress address : addresses) {
@@ -485,6 +492,7 @@ public class StressTestClient {
}
testCasesSinceLastMetricsCollection++;
+ totalCallCount.incrementAndGet();
double durationSecs = computeDurationSecs(lastMetricsCollectionTime);
if (durationSecs >= METRICS_COLLECTION_INTERVAL_SECS) {