summaryrefslogtreecommitdiffstats
path: root/vespa-feed-client
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2022-02-11 10:06:34 +0100
committerJon Marius Venstad <venstad@gmail.com>2022-02-11 10:06:34 +0100
commitacbb9e2a654cc7fd1074152ee5f3a2152c5b3a38 (patch)
tree2fa4111dbc9eaddc2be473c5827e5b987ae66c5a /vespa-feed-client
parentdeeef73ce7e42e26f325b4bb2d6f05112b31ff70 (diff)
Effectively join benchmark thread before re3ading stats
Diffstat (limited to 'vespa-feed-client')
-rw-r--r--vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/BenchmarkingCluster.java4
-rw-r--r--vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/HttpRequestStrategyTest.java14
2 files changed, 10 insertions, 8 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/BenchmarkingCluster.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/BenchmarkingCluster.java
index 40049bad217..f59eee25d42 100644
--- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/BenchmarkingCluster.java
+++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/BenchmarkingCluster.java
@@ -74,8 +74,8 @@ public class BenchmarkingCluster implements Cluster {
return getStats();
}
}
- catch (InterruptedException | ExecutionException ignored) {
- throw new RuntimeException(ignored);
+ catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
}
}
diff --git a/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/HttpRequestStrategyTest.java b/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/HttpRequestStrategyTest.java
index 13dc7ad4624..60e8c106b40 100644
--- a/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/HttpRequestStrategyTest.java
+++ b/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/HttpRequestStrategyTest.java
@@ -174,18 +174,20 @@ class HttpRequestStrategyTest {
now.set(605000);
assertEquals(OPEN, breaker.state()); // Circuit broken due to failed requests.
+ strategy.destroy();
+ OperationStats stats = strategy.stats();
Map<Integer, Long> codes = new HashMap<>();
codes.put(200, 4L);
codes.put(400, 1L);
codes.put(429, 2L);
codes.put(500, 3L);
- assertEquals(codes, strategy.stats().responsesByCode());
- assertEquals(3, strategy.stats().exceptions());
+ assertEquals(codes, stats.responsesByCode());
+ assertEquals(3, stats.exceptions());
- assertEquals(strategy.stats(), strategy.stats().since(initial));
- assertEquals(0, strategy.stats().since(strategy.stats()).averageLatencyMillis());
- assertEquals(0, strategy.stats().since(strategy.stats()).requests());
- assertEquals(0, strategy.stats().since(strategy.stats()).bytesSent());
+ assertEquals(stats, stats.since(initial));
+ assertEquals(0, stats.since(stats).averageLatencyMillis());
+ assertEquals(0, stats.since(stats).requests());
+ assertEquals(0, stats.since(stats).bytesSent());
}
@Test